Sometimes you need to open your workbook be started on a specific worksheet. With this macro, if a user is working with your workbook, they can’t go astray because the workbook starts on the exact worksheet it needs to.
Open a Workbook to a Specific Sheet
'------------------ ThisWorkbook ------------------
Private Sub Workbook_Open()
'Step 1: Select the specified sheet
Sheets("Sheet2").Select
End Sub
How This Macro Works
This macro uses the Workbook Open event to start the workbook on the specified sheet when the workbook is opened.
The macro explicitly names the sheet we want to jump — Sheet2, in this case, when it’s opened.
How to Use This Macro
Most VBA code should be placed in Standard Modules unless specified.
If you see a comment '------------------ Modules------------------
in the code header that means put the code in a Standard Module. For more information, learn this course: Where should I put the Excel VBA code?
The following steps teach you how to put VBA code into a Standard Module:
- Activate the Visual Basic Editor by pressing ALT + F11.
- Right-click the project/workbook name in the Project Window.
- Choose Insert -> Module.
- Type or paste the code in the newly created module. You will probably need to change the sheet name, the range address, and the save location.
- Click Run button on the Visual Basic Editor toolbar.
- For more information, learn this course: Programming with Excel VBA