NukedWhale
04-17-2008, 12:27 PM
Hello VBA Express! I'm new to this forum so bear with me. :hi:
I have an Excel 2007 workbook with many worksheets and 3 stacked bar charts per worksheet. I'm pretty inexperienced with VBA so I might need a little handholding.
I'm trying to write a macro that will resize all charts and change the position of data labels for 2 series within the charts (I already have bad labels in place so labels may need to be deleted then reapplied).
This is my current loop to resize charts...how do I include the code to mess with data labels within my loop?
Sub Resize()
Dim iChart As Long
Dim nCharts As Long
Let nCharts = ActiveSheet.ChartObjects.Count
For iChart = 1 To nCharts
With ActiveSheet.ChartObjects(iChart)
.Height = 480
End With
Next
End Sub
This is sort of what the macro recorder code looked like for positioning the data labels the way I wanted to.
SeriesCollection(2).DataLabels = msoElementDataLabelInsideBase
SeriesCollection(1).DataLabels = msoElementDataLabelInsideEnd
Thanks in advance,
NukedWhale
I have an Excel 2007 workbook with many worksheets and 3 stacked bar charts per worksheet. I'm pretty inexperienced with VBA so I might need a little handholding.
I'm trying to write a macro that will resize all charts and change the position of data labels for 2 series within the charts (I already have bad labels in place so labels may need to be deleted then reapplied).
This is my current loop to resize charts...how do I include the code to mess with data labels within my loop?
Sub Resize()
Dim iChart As Long
Dim nCharts As Long
Let nCharts = ActiveSheet.ChartObjects.Count
For iChart = 1 To nCharts
With ActiveSheet.ChartObjects(iChart)
.Height = 480
End With
Next
End Sub
This is sort of what the macro recorder code looked like for positioning the data labels the way I wanted to.
SeriesCollection(2).DataLabels = msoElementDataLabelInsideBase
SeriesCollection(1).DataLabels = msoElementDataLabelInsideEnd
Thanks in advance,
NukedWhale