Chart Question Using VBA

  • Thread starter Thread starter Sandy
  • Start date Start date
S

Sandy

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

Thanks
 
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 Where:=xlLocationAsObject, Name:=sht$

Hope this helps,

Hutch
 
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...
 
Tom, Thankyou - worked perfectly.

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

Thanks again,

Sandy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top