![]() |
Change Chart Typewith button
Is there a way to change ALL of my chart from a bar graph
to an X-Y or line chart? I have 27 charts on thier on sheet. I want to be able to have a button that runs a macro that will change all the chart to bar, then another to change it back to a line chart? Any thought? |
Change Chart Typewith button
The following macros will change all embedded charts on the active sheet:
'======================= Sub ChartsToLine() Dim chObj As ChartObject For Each chObj In ActiveSheet.ChartObjects chObj.Chart.ChartType = xlLine Next End Sub '=================================== Sub ChartsToColumn() Dim chObj As ChartObject For Each chObj In ActiveSheet.ChartObjects chObj.Chart.ChartType = xlColumnClustered Next End Sub '========================== wrote: Is there a way to change ALL of my chart from a bar graph to an X-Y or line chart? I have 27 charts on thier on sheet. I want to be able to have a button that runs a macro that will change all the chart to bar, then another to change it back to a line chart? Any thought? -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
Change Chart Typewith button
Change the code to the following:
'====================== Sub ChartsToLine() Dim ch As Chart For Each ch In ActiveWorkbook.Charts ch.ChartType = xlLine Next End Sub '================================ Sub ChartsToColumn() Dim ch As Chart For Each ch In ActiveWorkbook.Charts ch.ChartType = xlColumnClustered Next End Sub '=============================== Anonymous wrote: Debra, Thanks for the reply. These charts aren't embedded on a sheet, they are on chart sheets. How will I modify the code for it to work? I tried to change active sheet to activechart, but it did not work. Thanks JD -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
All times are GMT +1. The time now is 06:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com