+ Reply to Thread
Results 1 to 4 of 4

Change graph type

  1. #1
    Steve
    Guest

    Change graph type

    Hi

    Is there a way to flip a graph type between, say, a bar and a pie chart
    just by clicking a single on-screen user button? I know it's easy by
    right-clicking the graph and selecting the appropriate option, but it's
    an on-screen option I'm wondering about.

    Thanks in advance

    Steve


  2. #2
    Steve
    Guest

    Re: Change graph type

    Sorry, to clarify. I can make the change once by using the following
    command button code:

    Private Sub CommandButton1_Click()
    ActiveSheet.ChartObjects("Chart 1").Activate
    ActiveChart.ChartArea.Select
    ActiveChart.ChartType = xlLine
    End Sub

    However, what I want to do is revert back to the original format the
    second time the command button is clicked.

    Thanks

    Steve


  3. #3
    Pete
    Guest

    Re: Change graph type

    I think this will work. If you set up a variable, my_graph, and
    initalise it to "xlLine", then you can toggle this between pie chart
    and bar chart within your code and change the bottom line to:

    ActiveChart.ChartType = my_graph

    Pete


  4. #4
    Steve
    Guest

    Re: Change graph type

    Pete

    I had to experiment a bit as I wasn't sure quite what you meant, but
    have managed it now. Thanks!

    Steve


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1