PC Review


Reply
Thread Tools Rate Thread

Change graph type in VBA

 
 
New Member
Join Date: Sep 2008
Posts: 5
 
      2nd Sep 2008
Hi all,



I woud like to know if it's possible to change a graph's type, by VBA code. For exemple, i would like to change an histogramme graph into a sector's graph.



thanks in advance for all tips,
 
Reply With Quote
 
 
 
 
Senior Member
Stoneboysteve's Avatar
Join Date: Sep 2008
Location: USA
Posts: 131
 
      5th Sep 2008
To change the type of chart use similar code. This creates, then changes an existing, selected chart.

'this is the range for my chart data
Range("A1:Q11").Select
'this adds the chart
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:Q11"), PlotBy _
:=xlRows
ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
'this selects the existing chart
ActiveChart.ChartArea.Select
'this selects the new chart type
ActiveChart.ChartType = xl3DPie
 
Reply With Quote
 
New Member
Join Date: Sep 2008
Posts: 5
 
      8th Sep 2008
Thanks for your tip, i will try
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I change a bar graph to start mid-graph? ADPeterson Microsoft Powerpoint 2 23rd Oct 2008 10:17 AM
Graph of 2nd serious in the Line type graph is not connected Frank Situmorang Microsoft Excel Worksheet Functions 2 16th Jun 2008 05:09 AM
Change graph type Steve Microsoft Excel Misc 3 19th Dec 2005 09:04 AM
how to change the type of line on an access graph =?Utf-8?B?Tmlo?= Microsoft Access 1 11th Feb 2005 04:45 PM
What type of graph and how? july11 Microsoft Excel Charting 2 12th Dec 2003 05:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:38 PM.