kanbhold
kanbhold

Reputation: 173

How can I record a macro in excel that resizes my chart?

I start to record the macro, then I click on my chart, I resize it then I finish recording. The problem is that this recorded macro will only work on that specific chart that I selected during the recording.

Is there a way to record a macro that works on any selected chart? Excel writes this code:

Sub resize()
'
' resize Macro
'

'
    ActiveSheet.Shapes("Diagram 6").Height = 256.5354330709
    ActiveSheet.Shapes("Diagram 6").Width = 405.3543307087
End Sub

Thanks in advance!

Upvotes: 1

Views: 112

Answers (1)

Gary's Student
Gary's Student

Reputation: 96753

Select the shape or chart and run this:

Sub resize()
    Selection.Height = 256.5354330709
    Selection.Width = 405.3543307087
End Sub

Upvotes: 2

Related Questions