ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding HPageBreaks after a Chart (https://www.excelbanter.com/excel-programming/423700-adding-hpagebreaks-after-chart.html)

mathieu

Adding HPageBreaks after a Chart
 
Hi there,

I do not quite understand how I can add a HPageBreaks after a Chart.
HPageBreaks takes as parameter a Cell, while adding a Chart takes an
absolute position:

for ...
wc2 = ws.ChartObjects().Add(Left=left, Width=width, Top=top,
Height=height)
ws.HPageBreaks.Add(Before=ws.Cells((i+1)*20,1) )

Is there a way to Add a Chart on a particular Cell instead of an
absolute position

Thanks,

Dave Peterson

Adding HPageBreaks after a Chart
 
The .chartobject has a topleftcell property and a .bottomrightcell property.

This may give you an idea:

Dim ChartObj As ChartObject
Set ChartObj = ActiveSheet.ChartObjects(1)
With ChartObj
MsgBox .TopLeftCell.Row & vbLf & .BottomRightCell.Row
End With



mathieu wrote:

Hi there,

I do not quite understand how I can add a HPageBreaks after a Chart.
HPageBreaks takes as parameter a Cell, while adding a Chart takes an
absolute position:

for ...
wc2 = ws.ChartObjects().Add(Left=left, Width=width, Top=top,
Height=height)
ws.HPageBreaks.Add(Before=ws.Cells((i+1)*20,1) )

Is there a way to Add a Chart on a particular Cell instead of an
absolute position

Thanks,


--

Dave Peterson


All times are GMT +1. The time now is 02:55 PM.

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