Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
sm sm is offline
external usenet poster
 
Posts: 13
Default macro for fixed color lines in line chart based on series name

i plot line charts for the growth trends of top product brands..i want to
have the same color of the line for a particular brand in all the charts i
create...so i need a macro to have a fixed color for the series based on the
series name, so that i do not have to format each and every line of every
chart, which is very time consuming as i have to do some 50 charts..

i am using excel 2003
  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 2,489
Default macro for fixed color lines in line chart based on series name

Hi,

Something like this maybe, test on a copy first.

Sub X()
Dim objCht As ChartObject
Dim colData As Collection
Dim lngColorIndex As Long
Dim serX As Series

Set colData = New Collection
' colour value and unique series name
colData.Add 3, "A"
colData.Add 12, "B"
colData.Add 34, "C"
colData.Add 45, "D"

On Error Resume Next

For Each objCht In ActiveSheet.ChartObjects
For Each serX In objCht.Chart.SeriesCollection
lngColorIndex = -1
lngColorIndex = colData(UCase(serX.Name))
If lngColorIndex = 0 Then
serX.Border.ColorIndex = lngColorIndex
End If
Next
Next

End Sub

Cheers
Andy

sm wrote:
i plot line charts for the growth trends of top product brands..i want to
have the same color of the line for a particular brand in all the charts i
create...so i need a macro to have a fixed color for the series based on the
series name, so that i do not have to format each and every line of every
chart, which is very time consuming as i have to do some 50 charts..

i am using excel 2003


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chart series (based on datarange content) alecswan Excel Discussion (Misc queries) 0 July 19th 06 09:50 PM
Line Chart Aurora Charts and Charting in Excel 1 March 8th 06 09:27 PM
Combination chart - want only ONE series showing as a line, not 2. sincaa Charts and Charting in Excel 1 January 26th 06 10:28 AM
How to change Series order in a Combination Chart? vrk1 Charts and Charting in Excel 3 April 1st 05 07:21 AM
pivot table multi line chart souris Charts and Charting in Excel 2 December 7th 04 03:56 AM


All times are GMT +1. The time now is 09:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"