Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default 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

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
how to change the pivot chart automaticaly as values in the worksheet change Vinay Vasu Excel Worksheet Functions 0 May 3rd 10 04:25 PM
Change caption of a button Dylan @ UAFC[_2_] Excel Worksheet Functions 3 November 25th 08 07:04 PM
Excel bar chart formatting of bars to change colors as data change JudyT Excel Discussion (Misc queries) 1 January 24th 07 06:07 PM
Button to change borders dixonpeter Excel Discussion (Misc queries) 2 August 12th 05 01:30 PM
how to change range for dynamic chart in excel 2000 with button? ivan Charts and Charting in Excel 2 April 24th 05 04:10 AM


All times are GMT +1. The time now is 09:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"