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

Using Dot Leaders in a Paragraph

Adding dot leaders to your text is easy through the application of tab stops. This tip explains the steps you need to ...

Discover More

Changing WordArt Text

WordArt can be used with just about any text you want. Here's how to change the text.

Discover More

Noting Inactivity within a Timeframe

There are many times when you are creating a worksheet that you need to analyze dates within that worksheet. Once such ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (menu)

Cycling through Colors

Excel includes quite a few tools that are not normally accessible through the various toolbars. One such esoteric tool is ...

Discover More

Colors and Fonts for Worksheet Tabs

Changing the color used on a worksheet tab is easy. Just follow the three steps in this tip.

Discover More

Turning on Placeholders

A large number of graphics in a worksheet can slow down Excel. One way to compensate is to turn on picture placeholders, ...

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 8 + 5?

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.