LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default pivotchart colouring

i have the following code which should apply a specific colour to th
bar based on what the catagory is (as seen in my screenshot or th
table and chart)

Dim iPtCt As Long
Dim iPtIdx As Long

With ActiveChart.SeriesCollection(1)
iPtCt = .Points.Count
For iPtIdx = 1 To iPtCt
Select Case WorksheetFunction.Index(.XValues, iPtIdx)
Case "SMEP Projects & Commissioning"
.Points(iPtIdx).Interior.ColorIndex = 4
.Points(iPtIdx).ApplyDataLabels ShowValue:=True
Case "Special Projects Infrastructure"
.Points(iPtIdx).Interior.ColorIndex = 38
.Points(iPtIdx).ApplyDataLabels ShowValue:=True
Case "Permanent Way & Track"
.Points(iPtIdx).Interior.ColorIndex = 36
.Points(iPtIdx).ApplyDataLabels ShowValue:=True
Case "Special Projects - Property"
.Points(iPtIdx).Interior.ColorIndex = 35
.Points(iPtIdx).ApplyDataLabels ShowValue:=True
Case "L&E, Structures & Depot"
.Points(iPtIdx).Interior.ColorIndex = 34
.Points(iPtIdx).ApplyDataLabels ShowValue:=True
Case "JNUP & 7th Car"
.Points(iPtIdx).Interior.ColorIndex = 37
.Points(iPtIdx).ApplyDataLabels ShowValue:=True
Case "Comms & SCADA"
.Points(iPtIdx).Interior.ColorIndex = 39
.Points(iPtIdx).ApplyDataLabels ShowValue:=True
Case Else
.Points(iPtIdx).Interior.ColorIndex = 3
End Select
Next
End With

[image: http://www.darkcity.nildram.co.uk/pivot1.jpg]

its basically colouring all the bars red, which is colourindex 3, whic
is the 'else' at the bottom, even though 6 of the 7 cases are there i
the chart (screenshot shows what it looks like when i colour the bar
manually). anyone know why its not picking up the names of th
different column groups properly? i.e. i want it to colour the "comm
& scada" bars a certain colour, but it doesnt seem to recognise tha
those bars are part of comms & scada group (i didnt write this cod
someone on here did so i dont know).

and one last thing, is there some place where i can put this code s
that it also runs if someone selects a different 'date of work' fro
the top (as seen in my screenshot) ? because at the moment selecting
different date puts it back to defaults and u have to click anothe
sheet then click the chart sheet again so that the chart_activate i
called to do the colouring etc

Thanks

--
Message posted from http://www.ExcelForum.com

 
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
Duplicating PivotChart / Changing PivotChart data range BillG Charts and Charting in Excel 0 February 4th 09 08:56 PM
colouring cell KHAN Excel Discussion (Misc queries) 2 August 2nd 08 09:42 PM
Automatic colouring of cells plf100 Excel Worksheet Functions 3 March 29th 06 03:10 PM
Colouring rows Steven Excel Programming 1 September 2nd 03 05:30 PM


All times are GMT +1. The time now is 12:08 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"