D
deko
I need to format about 30 series on a number of charts. Sometimes I have
100 charts to loop through, which means 3000 series.
I'm wondering if there's a way to specify a group of series to format at
once rather than looping through each one individually. For example, is
there some way to say:
objChart.Series(3, 30).ColorIndex = 3
so that formatting is applied to series 3 through 30 at once?
Here's what I'm doing now, which seems rather slow:
Do While k < (objChart.SeriesCollection.Count)
k = k + 1
If k > 2 Then
objChart.SeriesCollection(k).Border.ColorIndex = st
objChart.SeriesCollection(k).Border.Weight = xlThin
objChart.SeriesCollection(k).Border.LineStyle = xlNone
objChart.SeriesCollection(k).MarkerBackgroundColorIndex = xlNone
objChart.SeriesCollection(k).MarkerForegroundColorIndex = st
objChart.SeriesCollection(k).MarkerStyle = xlDot
objChart.SeriesCollection(k).Smooth = False
objChart.SeriesCollection(k).MarkerSize = 2
objChart.SeriesCollection(k).Shadow = False
Else
If k = 2 Then
objChart.SeriesCollection(k).Delete
Else
objChart.SeriesCollection(k).Border.ColorIndex = sm
objChart.SeriesCollection(k).Border.Weight = xlThin
objChart.SeriesCollection(k).Border.LineStyle = xlContinuous
objChart.SeriesCollection(k).MarkerBackgroundColorIndex = sm
objChart.SeriesCollection(k).MarkerForegroundColorIndex = sm
objChart.SeriesCollection(k).MarkerStyle = xlDiamond
objChart.SeriesCollection(k).Smooth = False
objChart.SeriesCollection(k).MarkerSize = 3
objChart.SeriesCollection(k).Shadow = False
objChart.SeriesCollection(k).ErrorBar Direction:=xlY,
Include:=xlBoth, _
Type:=xlCustom, Amount:=xlapp.Workbooks _
(strXlsFile).Worksheets(sn).Range("C47:C" & lr), _
MinusValues:=xlapp.Workbooks(strXlsFile).Worksheets _
(sn).Range("C47:C" & lr)
objChart.SeriesCollection(k).ErrorBars.Border.ColorIndex = eb
objChart.SeriesCollection(k).ErrorBars.Border.Weight = xlThin
objChart.SeriesCollection(k).ErrorBars.Border.LineStyle =
xlContinuous
End If
End If
objChart.Axes(xlCategory).TickLabels.NumberFormat = "mm/dd/yyyy hh:mm;@"
objChart.Axes(xlCategory, xlPrimary).CategoryType = xlCategoryScale
Loop
Thanks in advance.
100 charts to loop through, which means 3000 series.
I'm wondering if there's a way to specify a group of series to format at
once rather than looping through each one individually. For example, is
there some way to say:
objChart.Series(3, 30).ColorIndex = 3
so that formatting is applied to series 3 through 30 at once?
Here's what I'm doing now, which seems rather slow:
Do While k < (objChart.SeriesCollection.Count)
k = k + 1
If k > 2 Then
objChart.SeriesCollection(k).Border.ColorIndex = st
objChart.SeriesCollection(k).Border.Weight = xlThin
objChart.SeriesCollection(k).Border.LineStyle = xlNone
objChart.SeriesCollection(k).MarkerBackgroundColorIndex = xlNone
objChart.SeriesCollection(k).MarkerForegroundColorIndex = st
objChart.SeriesCollection(k).MarkerStyle = xlDot
objChart.SeriesCollection(k).Smooth = False
objChart.SeriesCollection(k).MarkerSize = 2
objChart.SeriesCollection(k).Shadow = False
Else
If k = 2 Then
objChart.SeriesCollection(k).Delete
Else
objChart.SeriesCollection(k).Border.ColorIndex = sm
objChart.SeriesCollection(k).Border.Weight = xlThin
objChart.SeriesCollection(k).Border.LineStyle = xlContinuous
objChart.SeriesCollection(k).MarkerBackgroundColorIndex = sm
objChart.SeriesCollection(k).MarkerForegroundColorIndex = sm
objChart.SeriesCollection(k).MarkerStyle = xlDiamond
objChart.SeriesCollection(k).Smooth = False
objChart.SeriesCollection(k).MarkerSize = 3
objChart.SeriesCollection(k).Shadow = False
objChart.SeriesCollection(k).ErrorBar Direction:=xlY,
Include:=xlBoth, _
Type:=xlCustom, Amount:=xlapp.Workbooks _
(strXlsFile).Worksheets(sn).Range("C47:C" & lr), _
MinusValues:=xlapp.Workbooks(strXlsFile).Worksheets _
(sn).Range("C47:C" & lr)
objChart.SeriesCollection(k).ErrorBars.Border.ColorIndex = eb
objChart.SeriesCollection(k).ErrorBars.Border.Weight = xlThin
objChart.SeriesCollection(k).ErrorBars.Border.LineStyle =
xlContinuous
End If
End If
objChart.Axes(xlCategory).TickLabels.NumberFormat = "mm/dd/yyyy hh:mm;@"
objChart.Axes(xlCategory, xlPrimary).CategoryType = xlCategoryScale
Loop
Thanks in advance.