Excel: Macro to save all sheets with A1 cell selection & zoom 100%
Dim sheet As Object For Each sheet In ActiveWorkbook.Sheets sheet.Activate ActiveSheet.Range("A1").Select ActiveWindow.Zoom = 100 Next sheet ActiveWorkbook.Sheets(1).Activate If ActiveWorkbook.Path = "" Then Application.Dialogs(xlDialogSaveAs).Show Else ActiveWorkbook.Save End If
This macro performs four tasks.
- Set the selected cell in all sheets to A1.
- Set the zoom of all sheets to 100%.
- Activate the first sheet.
- Save the workbook.
It is useful when used as an add-in.
How to create macros and add-ins
If you save the macro as an add-in (.xlam), you can use it in all workbooks. It is easy and recommended to add it to the Quick Access Toolbar.
Create an add-in (.xlam)
- Open the editor from the “Developer > Visual Basic”.
* If the Developer tab is not displayed, go to “File > Options > Customize Ribbon” and check the Developer checkbox.
- Paste the code.
- Save the Excel book with the file extension “.xlam”.
Add to Quick Access Toolbar
- Click the arrow on the right end of the Quick Access Toolbar.
- Click on “More Commands”.
- Under “Choose commands from” select “Macros”.
- Select the saved macro and click “Add”.
- Close with “OK.” A macro button is added to the Quick Access Toolbar.