Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 39
Default Changing Colors in a Bar Chart

Hi guys,

I have a bar chart that has 3 bars in a chart. I am using a 2D
Clustered Column. I need for each bar to have a seperate color.

Name FSR QC CQA
Leola 2 8 0

The color for the three? Using Late Binding, as I can't use Early
Binding since others are using different versions of Excel (2002 and
2003).

Select Case .ActiveCell.Value
Case "QC"
.Sheets("Chart1").Select
.ActiveChart.SeriesCollection(x).Select
.Selection.Interior.ColorIndex = 19
Case "FSR"
.Sheets("Chart1").Select
.ActiveChart.SeriesCollection(x).Select
.Selection.Interior.ColorIndex = 18
Case "CQA"
.Sheets("Chart1").Select
.ActiveChart.SeriesCollection(x).Select
.Selection.Interior.ColorIndex = 17
Case Else
'Do nothing
End Select

Is this possible?

  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 6,582
Default Changing Colors in a Bar Chart

If you want to color points (bars) based on the category, try this sub:

Sub ColorPoints()
Dim iPoint As Long, nPoint As Long
With ActiveChart.SeriesCollection(1)
For iPoint = 1 To .Points.Count
Select Case WorksheetFunction.Index(.XValues, iPoint)
Case "AAAA"
.Points(iPoint).Interior.ColorIndex = 6 ' Yellow
Case "BBBB"
.Points(iPoint).Interior.ColorIndex = 5 ' Blue
Case "CCCC"
.Points(iPoint).Interior.ColorIndex = 3 ' Red
Case "DDDD"
.Points(iPoint).Interior.ColorIndex = 13 ' Purple
Case "EEEE"
.Points(iPoint).Interior.ColorIndex = 46 ' Orange
Case "FFFF"
.Points(iPoint).Interior.ColorIndex = 4 ' Green
Case "GGGG"
.Points(iPoint).Interior.ColorIndex = 8 ' Cyan
End Select
Next
End With
End Sub
If instead you ate coloring based on series name, try this:Sub ColorSeries()
With ActiveChart.SeriesCollection(1)
Select Case .Name Case "AAAA"
.Interior.ColorIndex = 6 ' Yellow
Case "BBBB"
.Interior.ColorIndex = 5 ' Blue
Case "CCCC"
.Interior.ColorIndex = 3 ' Red
Case "DDDD"
.Interior.ColorIndex = 13 ' Purple
Case "EEEE"
.Interior.ColorIndex = 46 ' Orange
Case "FFFF"
.Interior.ColorIndex = 4 ' Green
Case "GGGG"
.Interior.ColorIndex = 8 ' Cyan
End Select
End With
End Sub
- Jon-------Jon Peltier, Microsoft Excel MVPTutorials and Custom
SolutionsPeltier Technical Services, Inc. -
http://PeltierTech.com_______"EAB1977" wrote in
message ps.com...
Hi guys,

I have a bar chart that has 3 bars in a chart. I am using a 2D
Clustered Column. I need for each bar to have a seperate color.

Name FSR QC CQA
Leola 2 8 0

The color for the three? Using Late Binding, as I can't use Early
Binding since others are using different versions of Excel (2002 and
2003).

Select Case .ActiveCell.Value
Case "QC"
.Sheets("Chart1").Select
.ActiveChart.SeriesCollection(x).Select
.Selection.Interior.ColorIndex = 19
Case "FSR"
.Sheets("Chart1").Select
.ActiveChart.SeriesCollection(x).Select
.Selection.Interior.ColorIndex = 18
Case "CQA"
.Sheets("Chart1").Select
.ActiveChart.SeriesCollection(x).Select
.Selection.Interior.ColorIndex = 17
Case Else
'Do nothing
End Select

Is this possible?



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
changing colors of slices in a pie chart mread Charts and Charting in Excel 1 June 14th 07 10:16 PM
changing colors widman Excel Discussion (Misc queries) 3 October 16th 06 12:53 AM
pivot chart colors- how to keep from changing when data elements are added/removed? KR Charts and Charting in Excel 1 July 12th 06 06:41 PM
HOW TO CREATE A BUBBLE CHART WITH CHANGING COLORS? Hector Charts and Charting in Excel 2 May 14th 06 05:39 PM
How do i stop the colors changing on my pivot chart when i refres. kev from uk Excel Discussion (Misc queries) 1 March 2nd 05 01:51 PM


All times are GMT +1. The time now is 06:42 AM.

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

About Us

"It's about Microsoft Excel"