logo
search
VBA & Macro Problems

How to Open an Excel Workbook to a Specific Worksheet

WPS Content ManagerWPS Content Manager Oct 9, 2026 868 views

Question details

The user wants an online Excel workbook to automatically open to a designated worksheet every time it is accessed.

How to Open an Excel Workbook to a Specific Worksheet
Product
Microsoft Excel
Device & OS
not provided
Scenario
Accessing a shared or online workbook and needing it to default to a specific tab upon opening, rather than defaulting to the last viewed tab.
Observed behavior
Excel for the web opens the workbook on the last sheet used and does not provide a built-in option to force it to open on a specific worksheet.
Before you start

Since Excel for the web does not support VBA macros, you must open your file in the Excel desktop application to apply this automation.

Solution 1Recommended

Use the Workbook_Open VBA Event in Excel Desktop

By adding a simple VBA macro to your workbook via the desktop application, you can force the file to activate a specific sheet whenever it is opened.

Excel for the web cannot run VBA macros. However, if you add this macro using the desktop application, the file will execute it when opened in any macro-supported desktop environment.

1
Open the VBA Editor

Launch your workbook in the Excel desktop application. Press 'Alt + F11' on your keyboard to open the Visual Basic for Applications (VBA) editor.

2
Access ThisWorkbook

In the Project Explorer pane on the left side of the VBA editor, find your workbook's project and double-click on 'ThisWorkbook'.

3
Enter the VBA Code

In the code window that appears, paste the following code: Private Sub Workbook_Open() Sheets("YourSheetName").Activate End Sub. Replace 'YourSheetName' with the exact name of the tab you want to open first.

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 format dropdown menu to ensure your macro is saved.

Use the Workbook_Open VBA Event in Excel Desktop
Web Limitation: Keep in mind that while this works perfectly for desktop users, Excel for the web will ignore the VBA code and still open on the last saved sheet for web-only users.

Set a Default Starting Worksheet in WPS Spreadsheet

You can easily use the built-in VBA editor in WPS Spreadsheet to force your workbook to open on a specific tab every time it is launched, offering a seamless desktop alternative.

  1. 1. Open your Workbook in WPS Spreadsheet: Launch WPS Office and open the spreadsheet file you want to configure.
  2. 2. Access the Developer Tools: Navigate to the 'Developer' tab on the top ribbon and click on 'Visual Basic' to open the VBA editor.
  3. 3. Edit ThisWorkbook: In the left-hand Project window, double-click on 'ThisWorkbook'.
  4. 4. Input the Activation Code: Type or paste the following code: Private Sub Workbook_Open() Sheets("Sheet1").Activate End Sub (changing 'Sheet1' to your desired tab name).
  5. 5. Save the Document: Save your file as a Macro-Enabled Workbook (.xlsm) to ensure the startup script runs automatically upon the next launch.
Fully compatible with Microsoft Excel (.xlsx and .xlsm) file formatsBuilt-in VBA editor allows you to easily automate tasks like opening a specific worksheetLightweight and fast desktop application that runs smoothly on most devicesFamiliar user interface ensuring a zero-learning-curve transition
microsoft office alternative - wps office

Frequently Asked Questions

Why does my Excel online workbook always open on the last sheet used?

Excel for the web is specifically designed to remember the last active sheet when the workbook was saved or closed. Microsoft has not yet implemented a built-in feature or setting in the web version to designate a default startup worksheet.

Will the VBA macro work if I share the file via Excel for the web?

No, Excel for the web does not support or execute VBA macros. If a user opens your macro-enabled file (.xlsm) directly in their web browser, the platform will ignore the VBA code and open on the last saved sheet. They must open the file in the desktop app for the macro to trigger.

Can I use Office Scripts to open a specific worksheet in Excel Online?

While Office Scripts can automate many tasks in Excel for the web, they cannot currently be triggered automatically 'On Open' like a VBA Workbook_Open event. A user would still need to manually run the script after opening the file.