ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Size & Position charts on Sheet (https://www.excelbanter.com/excel-programming/310254-re-size-position-charts-sheet.html)

Jon Peltier[_8_]

Size & Position charts on Sheet
 
Bruce -

I avoid the scalewidth and scaleheight. To resize all the charts, use a
loop like this:

Dim ChtOb As ChartObject
For Each ChtOb In ActiveSheet.ChartObjects
With ChtOb
' dimensions in points
.Height = 200
.Width = 275
End With
Next

If you have an algorithm for arraying your chart objects, you can use a
similar loop to adjust the .top and .left of each chart object.

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

Bruce wrote:

I would like to resize and reposition a number of charts on my worksheet,
however I do not know how many charts there will be or what chart number they
will be.

So far I have setup code to add the charts as my chart array changes in size.

1) How do I set the scalewidth and scaleheight for all charts

I have tried changing this;
ActiveSheet.Shapes("Chart 23").ScaleWidth 0.6, msoFalse, msoScaleFromTopLeft
into
ActiveChart.ChartArea.ScaleWidth 0.91, msoFalse, msoScaleFromTopLeft
but ive got something wrong....

2) For the positioning, say if I had 10 charts on the worksheet it would
arrange them as 2x5. When the array is 8 charts it would do 2x4. Any ideas on
how to do this?

Bruce




All times are GMT +1. The time now is 09:26 AM.

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