logo
search
VBA & Macro Problems

How to Use a VBA Script to Open Excel Worksheets at 125% Zoom

Steve KSteve K Oct 9, 2026 870 views

Question details

The user needs a VBA solution to ensure that all workbooks and their worksheets automatically open at a 125% zoom level, regardless of how the file was saved.

How to Use a VBA Script to Open Excel Worksheets at 125% Zoom
Product
Microsoft Excel
Device & OS
not provided
Scenario
Opening spreadsheet files where the user consistently prefers a 125% view scale for better readability, requiring an automated adjustment upon file load.
Observed behavior
Excel workbooks currently open at the zoom level they were last saved with, requiring manual zooming for each individual worksheet.
Before you start

Ensure that the Developer tab is enabled in your ribbon and that you have enabled macros in your Trust Center settings so the VBA script can run upon opening.

Solution 1Recommended

Use the Workbook_Open Event in ThisWorkbook

By adding a macro to the specific workbook's code module, you can force it to loop through all worksheets and set the zoom level to 125% automatically whenever the file is opened.

This solution works perfectly for an individual file. It uses the Workbook_Open event to trigger a loop that activates each worksheet one by one and applies the ActiveWindow.Zoom property. Because the macro must activate each sheet to change its zoom, it will return to the first sheet at the end of the script for a seamless experience.

1
Open the VBA Editor

Open your Excel workbook and press Alt + F11 on your keyboard to launch the Microsoft Visual Basic for Applications (VBA) editor.

2
Access the ThisWorkbook Module

In the Project Explorer pane on the left side, find your workbook name. Double-click on 'ThisWorkbook' to open its dedicated code window.

3
Insert the VBA Code

Copy and paste the following code into the window: Private Sub Workbook_Open() Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets ws.Activate ActiveWindow.Zoom = 125 Next ws ThisWorkbook.Worksheets(1).Activate End Sub

4
Save as a Macro-Enabled Workbook

Close the VBA editor. Go to File > Save As, and choose 'Excel Macro-Enabled Workbook (*.xlsm)' from the file type dropdown menu to ensure your script is saved.

Use the Workbook_Open Event in ThisWorkbook
Return to the First Sheet: The line 'ThisWorkbook.Worksheets(1).Activate' ensures that after setting the zoom for all tabs, the workbook displays the very first sheet to the user.

Run VBA Macros Seamlessly in WPS Spreadsheet

WPS Office provides native support for VBA macros in its advanced versions. You can easily automate repetitive tasks, including setting default worksheet zoom levels, using the exact same VBA codes you would use in Microsoft Excel.

  1. 1. Open WPS Spreadsheet: Launch WPS Office and open your spreadsheet file.
  2. 2. Enable the Developer Tab: Navigate to the top ribbon, click on 'Tools', and select 'Developer' to access macro features.
  3. 3. Open the VBA Editor: Click the 'VBA Editor' icon to open the coding interface, and double-click 'ThisWorkbook' in the Project window.
  4. 4. Paste and Save: Paste your Workbook_Open zoom script into the code window, save your document as a Macro-Enabled file (.xlsm), and enjoy automatic zooming.
High compatibility with Microsoft Excel (.xlsx, .xlsm, .xlsb) formats.Native VBA editor support for writing and running macro scripts seamlessly.Free to download and incredibly lightweight on system resources.User-friendly interface that closely resembles classic spreadsheet tools.
microsoft office alternative - wps office

Frequently Asked Questions

Can I change the VBA script to open at a different zoom level, like 150%?

Yes, you can easily customize the zoom percentage. In the VBA script, locate the line that says 'ActiveWindow.Zoom = 125' and change the number '125' to '150' or any other percentage you prefer.

Why is the VBA zoom script not running when I open my file?

This usually happens because macros are disabled by default for security reasons. Go to File > Options > Trust Center > Trust Center Settings > Macro Settings, and select 'Enable VBA macros'. Also, ensure you saved the file as a Macro-Enabled Workbook (.xlsm).

Will this script apply the 125% zoom to new sheets I add later?

No, the 'Workbook_Open' event only runs once when the file is initially opened. If you add a new worksheet, it will default to the standard 100% zoom. To automatically zoom new sheets, you would need to add a 'Workbook_NewSheet' event script in the ThisWorkbook module.

Is there a way to set the default zoom level to 125% without using VBA?

Excel does not have a built-in global setting to permanently change the default zoom level for all existing files. However, for new files, you can create a customized blank workbook template (Book.xltx) with all sheets set to 125% zoom and save it in your XLSTART folder.