Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Default Worksheet when Opening.

Default Worksheet when Opening

by Allen Wyatt
(last updated June 25, 2018)

9

When you open a workbook, Excel normally displays the worksheet last displayed when the workbook was last saved. You may want a specific worksheet to always be displayed when the workbook is opened, regardless of the worksheet displayed when the workbook was last saved.

You can control which worksheet is displayed by using this macro:

Private Sub Workbook_Open()
    Worksheets("StartSheet").Activate
End Sub

This macro will always display a worksheet named StartSheet. You will obviously need to change the worksheet name to something different; it should exactly match the name of the desired worksheet.

For this macro to work properly, it has to be associated with the workbook object. Follow these steps:

  1. Make sure you have only a single Excel workbook open. While this isn't exactly mandatory, it will make creating the macro a bit easier.
  2. Press Alt+F11 to display the VBA Editor.
  3. In the Project Explorer window you will see a list of the open workbooks and templates. If the Project Explorer is not visible on your screen, choose Project Explorer from the View menu.
  4. Locate your current workbook in the Project Explorer. It will be named something like VBAProject (MyWorkbook), where "MyWorkbook" is the name of the actual workbook.
  5. If there is a plus sign to the left of the current workbook in the Project Explorer, click on it. You should see a list of worksheets appear underneath the workbook.
  6. If you don't see a list of worksheets, but instead see a list of folders with plus signs to their left, click on the plus sign to the left of Microsoft Excel Objects. Now you should see the worksheets.
  7. At the bottom of the list of worksheets is the ThisWorkbook object. Double-click on it. A code window is opened.
  8. In the code window, paste or create the macro shown above. Make sure you name it exactly as shown.
  9. Close the VBA Editor.
  10. Save your workbook.

Now, whenever you open the workbook, the specified worksheet will be displayed.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2014) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Default Worksheet when Opening.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Adding Columns to Your Page Layout

Most documents are created using a single column of text. Word, however, allows you to use many, many columns in your ...

Discover More

Positive and Negative Colors in a Chart

When creating a line cart, the line can show values both positive and negative values. This tip explains how you can use ...

Discover More

Determining How Many Styles are Available

Got a macro that processes or uses styles? You definitely need to know how many styles Word has available in the ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (menu)

Creating Superscript and Subscript Buttons

Want a quick way to apply superscript and subscript to selected text within a cell? This tip shows how the formatting can ...

Discover More

Enlarging the Formula Bar

The Formula bar is used to display the formula that appears in a cell. You may want to modify how the Formula bar is ...

Discover More

Controlling the Display of Toolbars

The various toolbars available in Excel are indispensable when it comes to easily accomplishing tasks. Here is a concise ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is three minus 2?

2018-11-02 03:07:13

Alan Elston

Hallo again Heidi
Just to quote Allen Wyatt:--....."..You will obviously need to change the worksheet name to something different; it should exactly match the name of the desired worksheet...."....


2018-11-02 03:04:04

Alan Elston

Hello Heidi
Usually that error means that you don’t have a Worksheet with the tab name that you are trying to use in this part of the code: (“ “). If you are using the code exactly as Allen has given it , then you must have a tab name of "StartSheet". Usually , if you are using a normal/ default workbook in an English version of Excel, then the code line that you usually need would be for the first sheet:
Worksheets("Sheet1").Activate
and for the second sheet the code line would usually be:
Worksheets("Sheet2").Activate
As an alternative, you can refer to a worksheet item by its index number ( The index number is an integer counting the tabs as you see them from the left. So, for example, the first worksheet tab from the left has index number 1 ). So for example, to refer to the second sheet, an alternative code line would be
Worksheets.Item(2).Activate

Alan Elston


2018-11-01 16:09:56

Heidi

Getting a run-time error 9
Subscript out of range


2018-09-14 05:29:11

Manish Maurya

It is not working, It says
Activate method of Worksheet Class Failed


2018-02-01 11:08:26

Willy Vanhaelen

@Mark
Perhaps you use
Private Sub Workbook_Activate()
istead of
Private Sub Workbook_Open()


2018-01-31 08:46:20

Mark Arnold

Allen

Thank You for all you do. This is something I use all the time but just came across an anomoly. I have the macro so that my file opens on the page that I want , but if I go temporarily to use a different excel spreadsheet and then return to the one with the code it goes back to the initial opening window rather than stay on the page I was on, even though the worksheet was already open. is there any way I can stop this from happening.

Thanks


2017-12-20 14:37:37

Megan Smith

Doesn't seem to work for 2013?


2017-09-09 08:24:36

Frank Natalia

Most helpful. I would add that after adding Macro you have to save your Workbook in a Macro-Enabled format. (Save as)


2017-08-19 12:21:46

Robert Matthews

Worked great - thanks! Might be worth saying at point 8

"In the code window, paste or create the macro shown above. Make sure you use exactly the format shown - including the quote marks - around the sheet name you want to open with".


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.