#1   Report Post  
Posted to microsoft.public.excel.misc
Steve
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Steve
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Pete
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Steve
 
Posts: n/a
Default 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
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
changing the color of a single bar on a graph Brian Charts and Charting in Excel 1 November 22nd 05 04:55 PM
How can I change a graph with 2 bars,2 lines to 3 bars, 1 line? IOWAJulie Charts and Charting in Excel 3 October 19th 05 11:13 PM
How do you change the values of a graph on the x-axis? tman224 New Users to Excel 1 October 13th 05 01:24 AM
How to prevent Excel 2003 from automatically change chart type Oscar II Charts and Charting in Excel 2 October 1st 05 02:57 PM
How do I change file/open/"files of type" to default to "all file. How do I changefiles of type default Excel Discussion (Misc queries) 1 April 19th 05 10:45 PM


All times are GMT +1. The time now is 04:49 PM.

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"