ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Size and location of an embedded chart (https://www.excelbanter.com/excel-programming/302911-size-location-embedded-chart.html)

Raul[_4_]

Size and location of an embedded chart
 
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

Raul[_4_]

Size and location of an embedded chart
 
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

-----Original Message-----
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
.


Jon Peltier[_7_]

Size and location of an embedded chart
 
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/
_______


Raul wrote:

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




All times are GMT +1. The time now is 12:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com