View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
lopsided[_8_] lopsided[_8_] is offline
external usenet poster
 
Posts: 1
Default Problem with using a macro to create a chart

Hi,

I am struggling with how to create a new graph in my spreadsheet and
place it as an object in an existing sheet. The code i have (mainly
salvaged from using the record function) fails on the highlighted line
below. Even replaying the recorded macros dont help as they still fail
at this line.

Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Worksheets(1).Range("A1")
ActiveChart.Location Whe=xlLocationAsObject, _
Name:="GIFcontainer"

It seems that as soon as the first line is executed a new sheet is
automatically created containing the new graph hence messing up the
last line.


Does anyone know whats going on?

Many Thanks,
Tom


---
Message posted from http://www.ExcelForum.com/