Skip to main content

Excel Macro: Open a Workbook to a Specific Sheet

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
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.

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:

  1. Activate the Visual Basic Editor by pressing ALT + F11.
  2. Right-click the project/workbook name in the Project Window.
  3. Choose Insert -> Module.
  4. 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.
  5. Click Run button on the Visual Basic Editor toolbar.
  6. For more information, learn this course: Programming with Excel VBA

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>