Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
I am trying to change the color of a Series Collection using visual basic. I
have tried things like "Chart(1).SeriesCollection(2).Points.Interior.Colo r = 3" among many others, if you could give me any help I would appreciate it. Thanks |
#2
![]() |
|||
|
|||
![]()
Koreef,
The examples below assume you are working with embedded charts: To change all of the series colors for all charts in a worksheet (edit out the markers if you don't want them): Sub LoopSeries() Dim ws As Worksheet Dim ct As ChartObject Dim ser As Series For Each ws In Worksheets For Each ct In ws.ChartObjects For Each ser In ct.Chart.SeriesCollection ser.Border.ColorIndex = 3 ser.MarkerForegroundColorIndex = 3 ser.MarkerBackgroundColorIndex = 3 Next ser Next ct Next ws End Sub If you just want to do one chart, you can activate it by clicking on it once. Then run this: Sub LoopSeries() Set cht = ActiveChart Set Srs = cht.SeriesCollection For Each Sr In Srs Sr.Border.ColorIndex = 3 Next Sr End Sub Another option that goes after the first chart in the workbook: Sub LoopSeries() Set cht = ActiveSheet.ChartObjects(1).Chart Set Srs = cht.SeriesCollection For Each Sr In Srs Sr.Border.ColorIndex = 3 Next Sr End Sub Finally, use this logic to go after a named embedded chart: Sub LoopSeries() Set cht = ActiveSheet.ChartObjects("Chart 1") Set Srs = cht.Chart.SeriesCollection For Each Sr In Srs Sr.Border.ColorIndex = 3 Next Sr End Sub Please post back if you are referring to chart sheets. ---- Regards, John Mansfield http://www.pdbook.com "Koreef" wrote: I am trying to change the color of a Series Collection using visual basic. I have tried things like "Chart(1).SeriesCollection(2).Points.Interior.Colo r = 3" among many others, if you could give me any help I would appreciate it. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Changing "Series" Name | Charts and Charting in Excel | |||
How to add series with VBA? | Charts and Charting in Excel | |||
Two bars for a Chart with a Secondary Axis | Charts and Charting in Excel | |||
Dynamic series in Chart | Charts and Charting in Excel | |||
Quickly Changing Several Series to Appear the Same | Charts and Charting in Excel |