Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 355
Default Chart Question Using VBA

How do I add a chart to he active worksheet? It always makes a new sheet.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,069
Default Chart Question Using VBA

In the code where you are creating the chart, use a .Location statement to
tell Excel to place the chart as an object on a specified sheet (in this case
the active sheet). For example,

Dim sht As String
sht$ = ActiveSheet.Name
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData _
Source:=Sheets(sht$).Range("A5:E26"), PlotBy:=xlColumns
ActiveChart.Location Whe=xlLocationAsObject, Name:=sht$

Hope this helps,

Hutch

"Sandy" wrote:

How do I add a chart to he active worksheet? It always makes a new sheet.

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Chart Question Using VBA

Step 4 of the chart wizard asks you where you want the chart to land. Ensure
that it is object in ??? sheet and not as new sheet...
--
HTH...

Jim Thomlinson


"Sandy" wrote:

How do I add a chart to he active worksheet? It always makes a new sheet.

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 355
Default Chart Question Using VBA

Tom, Thankyou - worked perfectly.

Can you tell me how to place the chart on the sheet where I want it?

Thanks again,

Sandy

"Tom Hutchins" wrote:

In the code where you are creating the chart, use a .Location statement to
tell Excel to place the chart as an object on a specified sheet (in this case
the active sheet). For example,

Dim sht As String
sht$ = ActiveSheet.Name
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData _
Source:=Sheets(sht$).Range("A5:E26"), PlotBy:=xlColumns
ActiveChart.Location Whe=xlLocationAsObject, Name:=sht$

Hope this helps,

Hutch

"Sandy" wrote:

How do I add a chart to he active worksheet? It always makes a new sheet.

Thanks

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
Chart Question Mike Excel Discussion (Misc queries) 3 October 17th 09 02:16 AM
Pie Chart Question Bill Charts and Charting in Excel 3 March 8th 09 06:41 AM
pie chart question jlc Excel Discussion (Misc queries) 3 January 31st 07 01:07 AM
Bar Chart Question scott Excel Discussion (Misc queries) 4 August 11th 06 01:18 PM
another chart question Gary Keramidas[_2_] Excel Programming 3 July 7th 05 01:37 AM


All times are GMT +1. The time now is 12:24 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"