ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   Resizing Chart window using VBA (https://www.excelbanter.com/charts-charting-excel/138752-resizing-chart-window-using-vba.html)

Barb Reinhardt

Resizing Chart window using VBA
 
Using VBA, how do I resize a chart window to be the same on all worksheets
within the workbook

I have something like this already:

For Each aWS In ActiveWorkbook.Worksheets
For Each objChart In aWS.ChartObjects
...blah blah blah
'objChart.ScaleWidth 1, msoFalse, msoScaleFromTopLeft
'objChart.ScaleHeight 1, msoFalse, msoScaleFromBottomRight
next objchart
next aWS

I believe the objchart.scale ... lines just change the height or width to a
ratio of the current height or width. What I want is to have all of the
chart windows within the workbook be the same size.

Thanks

Jon Peltier

Resizing Chart window using VBA
 
Hi Barb -

Try this:

For Each aWS In ActiveWorkbook.Worksheets
For Each objChart In aWS.ChartObjects
objChart.Width = <width
objChart.Height = <height
next objchart
next aWS

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


"Barb Reinhardt" wrote in message
...
Using VBA, how do I resize a chart window to be the same on all worksheets
within the workbook

I have something like this already:

For Each aWS In ActiveWorkbook.Worksheets
For Each objChart In aWS.ChartObjects
...blah blah blah
'objChart.ScaleWidth 1, msoFalse, msoScaleFromTopLeft
'objChart.ScaleHeight 1, msoFalse, msoScaleFromBottomRight
next objchart
next aWS

I believe the objchart.scale ... lines just change the height or width to
a
ratio of the current height or width. What I want is to have all of the
chart windows within the workbook be the same size.

Thanks





All times are GMT +1. The time now is 08:07 AM.

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