If you have a lot of charts in one worksheet in Excel and you want to organize them, what will you do? You can achieve it with the help of Macros in Excel. VBA and Macros are really easy to understand and perform tasks. In this article, we are going to see how to resize all charts using Macros (VBA) in Excel Office 365. Let’s get into this article.
Instructions to Resize All Charts using Macros:
Follow the below instructions to resize all charts in Excel.
- In the below screenshot, you can see three charts in one worksheet, and we are going to resize all of them.
- On the Developer Tab, select the Visual Basic option under the Code section.
- Then you need to copy and paste the code given below.
VBA code to resize charts using Macros
‘Change the Width and Height values below
Sub ResizeCharts()
Dim counter As Integer
‘Loop through all of the charts
For counter = 1 To ActiveSheet.ChartObjects.Count
With ActiveSheet.ChartObjects(counter)
.Height = 200
.Width = 200
End With
Next counter
End Sub
- You need to save the code by selecting it. Then close the window.
- You have to open the sheet containing the data. On the Developer Tab, choose the Macros option in the Code section.
- You need to make sure that your macro is selected and click the Run button.
- At last, you will see all the resized charts in your worksheet, and you can organize them as you wish.
- Refer to the below image.
Summary:
In the above article, we have described the simple instructions to resize all charts using Macros (VBA) in Excel Office 365. Share your suggestions/feedback in the below comment section. Thanks for visiting Geek Excel. Keep Learning!
Top comments (0)