Size and location of an embedded chart

R

Raul

Can anyone tell me how to specify the size and the
location of a chart embedded in a worksheet? I can
create the chart programmatically but I have to manually
move the chart to the desired location. The chart gets
created on the desired worksheet but not near the desired
cell.

Thanks,
Raul
 
R

Raul

Andy Pope sent the following which answered my questions
and resolved the issue.

To position a chart over C4:G12 use the following code
after the chart has been created.

' position C4:G12
With ActiveChart.Parent
.Left = Range("C4").Left
.Top = Range("C4").Top
.Width = Range("H4").Left - .Left
.Height = Range("G13").Top - .Top
End With

Thanks Andy,
Raul
 
J

Jon Peltier

Raul -

Create it using ChartObjects.Add, not Charts.Add:

Dim MyChart as Chart
With ActiveSheet
Set MyChart = .ChartObjects.Add(100,100,350,275).Chart
'' (left, top, width, height in points)
End With

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
 
Top