Reputation: 1
I wrote a previous macro to graph data on each of 300 sheets I have.
However, all of the graphs are too narrow to properly see the data:
Sub stretchtest()
ActiveSheet.Shapes(Charts(Charts.Count)).ScaleWidth 2, msoFalse, _
msoScaleFromTopLeft
End Sub
This current code throws the error: "subscript out of range"
I want the macro to: a) Take the most recently added chart and scale it to be twice as wide; OR b) Take all charts and make them all twice as wide.
Thank you!
Upvotes: 0
Views: 150
Reputation: 6073
This should do it:
Sub stretchtest()
ActiveSheet.ChartObjects(ActiveSheet.ChartObjects.Count).ScaleWidth 2, msoFalse, _
msoScaleFromTopLeft
End Sub
Upvotes: 1