View Single Post
 
Old 02-24-2006, 01:25 PM
hzrvkt hzrvkt is offline
Novice
 
Join Date: Feb 2006
Posts: 1
hzrvkt
Default Help with a macro to shade a selected pie chart

I have a simple spreadsheet that we use at work to update training records. The sheet has a pie chart with four quadrants beside each name and four command buttons on the screen. I want to be able to select the pie chart I want to update, then click command button 1 to shade one quadrant, command button 2 to shade the second quadrant, etc. I can figure out how to do one chart but I don't know how to run my shading macro on the active chart that I have selected. Can anyone help?

This one works but only for one chart Not the one that is selected:


ActiveSheet.ChartObjects("Chart 9").Activate
ActiveChart.SeriesCollection(1).Select
ActiveChart.SeriesCollection(1).Points(1).Select
With Selection.Border
.ColorIndex = 48
.Weight = xlThin
.LineStyle = xlContinuous
End With
Selection.Shadow = False
With Selection.Interior
.ColorIndex = 56
.Pattern = xlSolid
End With
ActiveWindow.Visible = False
Windows("Flex Chart Plan Maint.xls").Activate
Range("C3").Select
End Sub

This is what I tried to come up with for the Active Chart:

ActiveChart.SeriesCollection(1).Select
ActiveChart.SeriesCollection(1).Points(4).Select
With Selection.Border
.ColorIndex = 48
.Weight = xlThin
.LineStyle = xlContinuous
End With
Selection.Shadow = False
With Selection.Interior
.ColorIndex = 1
.Pattern = xlSolid
End With
End Sub

I get a runtime error'1004'
Select method of Series Class Failed
When I go into debug it takes me to the first line! Help!
Reply With Quote