Positioning a chart on the worksheet

G

Guest

I created a chart, used ActiveChart.Parent.Name = "MyChart" to give it a name
and then wrote the following code to situate it with its top left corner on
cell C3 but I get a runtime error to the effect "an object is required".
Dim ChtObj As ChartObject
Set ChtObj = MyChart
ChtObj.Top = Range("C3").Top
ChtObj.Left = Range("C3").Left
Pretty basic problem but can someone set me straight please, TIA .. Greg
 
R

Rowan Drummond

Maybe:

Dim ChtObj As ChartObject
Set ChtObj = ActiveSheet.ChartObjects("MyChart")
ChtObj.Top = Range("C3").Top
ChtObj.Left = Range("C3").Left


Hope this helps
Rowan
 

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

Top