I have a series of Pie charts arranged around a circle and I would like to be able to toggle the start angle of the first slice using a drop down that I've already created.
Here's my code:
I recorded a macro to select the chart series and manually change it and then tried to create this based off of it. My drop down only has the two values "0 Start" and "Rotate"VB:Public Sub RotateSeries(ByVal Target As Range) ' ' RotateSeries Macro ' If Target.Address = "$P$10" Then Select Case Target.Text ' Select Case Target.Range("$P$10").Value Case Is = "0 Start" ActiveSheet.ChartObjects("Chart 37").Activate ActiveChart.ChartGroups(1).FirstSliceAngle = 0 Case Is = "Rotate" ActiveSheet.ChartObjects("Chart 37").Activate ActiveChart.ChartGroups(1).FirstSliceAngle = 270 End Select End If End Sub
Thanks in advance for the help.
Last edited by AAE; June 25th, 2013 at 09:13. Reason: add code tags
Welcome to Ozgrid.
Please read the forum rules and learn to use code tags.
All VBA code posted in the forum must be wrapped in code tags, which you omitted, including single-line code snippets.
I've added the tags for you this time only. Be sure to use them in future posts.
How to use code tags
your code goes between these tags
Or, just highlight all of the code and press the # button to add the code tags
Here is the idea:
Change your drop down to contain true numbers, adjust the range reference accordingly.VB:ActiveChart.ChartGroups(1).FirstSliceAngle = ActiveSheet.Range("A1").value
There are currently 1 users browsing this thread. (0 members and 1 guests)