Excel Macros For Dummies, 3rd Edition
Book image
Explore Book Buy On Amazon
In some situations, it's imperative that your Excel workbook be started on a specific worksheet. With this macro, if users are working with your workbook, they can't go astray because the workbook starts on the exact worksheet it needs to.

In the example illustrated here, you want the workbook to go immediately to the sheet called Start Here.

Open the workbook to the Start Here sheet.

Open the workbook to the Start Here sheet.

How the macro works

This macro uses the workbook's Open event to start the workbook on the specified sheet when the workbook is opened:
Private Sub Workbook_Open()
'Step 1: Select the specified sheet
     Sheets("Start Here").Select
End Sub
The macro explicitly names the sheet the workbook should jump to when it's opened.

How to use the macro

To implement this macro, you need to copy and paste it into the Workbook_Open event code window. Placing the macro here allows it to run each time the workbook is opened:
  1. Activate Visual Basic Editor by pressing Alt+F11.

  2. In the project window, find your project/workbook name and click the plus sign next to it to see all the sheets.

  3. Click ThisWorkbook.

  4. In the Event drop-down list, select the Open event.

  5. Type or paste the code in the newly created module, changing the sheet name, if necessary.

    Enter your code in the Workbook Open event.

    Enter your code in the Workbook Open event.

About This Article

This article is from the book:

About the book authors:

Michael Alexander is a Microsoft certified application developer and author of several books on advanced business analysis with Microsoft Access and Microsoft Excel. He has been named a Microsoft MVP for his ongoing contributions to the Excel community. Dick Kusleika has been helping users get the most out of Microsoft Office products for more than 25 years through online forums, blogging, books, and conferences.

This article can be found in the category: