Ozgrid Excel Help & Best Practices Forums

Excel Training / Excel Dashboards Reports

Results 1 to 2 of 2

Thread: Changing First Slice Angle of a Pie Chart based on cell reference

  1. #1
    Join Date
    10th June 2013

    Changing First Slice Angle of a Pie Chart based on cell reference

    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:
    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 
    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"

    Thanks in advance for the help.

    Last edited by AAE; June 25th, 2013 at 09:13. Reason: add code tags

    Excel Video Tutorials / Excel Dashboards Reports

  2. #2
    Join Date
    19th January 2007
    South Carolina, USA

    Re: Changing First Slice Angle of a Pie Chart based on cell reference

    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:
    ActiveChart.ChartGroups(1).FirstSliceAngle = ActiveSheet.Range("A1").value 
    Change your drop down to contain true numbers, adjust the range reference accordingly.

    Forum Rules | Message to Cross Posters | How to use Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Possible Answers

  1. Format Chart Bars Based On Cell Reference
    By Neilneedshelp in forum Excel General
    Replies: 7
    Last Post: January 25th, 2010, 00:15
  2. Angle Text To Follow Chart Series Line
    By nb- in forum Excel General
    Replies: 6
    Last Post: September 4th, 2007, 11:30
  3. Gradient Colorize Chart Points Based On Cell Reference
    By nathantabb in forum Excel General
    Replies: 7
    Last Post: July 13th, 2007, 23:12
  4. Create Chart Based On Changing Data
    By Nashkat in forum Excel General
    Replies: 2
    Last Post: December 23rd, 2006, 08:45
  5. Chart Based on Changing/Increasing Data
    By crombes in forum Excel General
    Replies: 4
    Last Post: September 8th, 2006, 22:57


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts