MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Open a worksheet to a specific work sheet


Posted by Chris on December 26, 2001 1:10 PM

I have several sheets within my spreadsheet and
I want one of them to open up and show everytime
I open the spreadsheet. Is there some kind of macro
that I can run?


Posted by Juan Pablo G. on December 26, 2001 1:14 PM

In ThisWorkbook module put this

Private Sub Workbook_Open()
Sheets("Sheet1").Select
End Sub

Juan Pablo G.

Posted by Jim on December 26, 2001 1:19 PM

Hi Chris,

Keypress Alt F11
In Project Explorer - click on ThisWorkbook

and type:

Option Explicit
Private Sub Workbook_Open()
Sheets(your sheet).Activate
End Sub

Jim

Posted by Chris on December 26, 2001 1:45 PM


This does not seem to work.

Posted by Juan Pablo G. on December 26, 2001 1:47 PM

Why not ?

You have to replace "Sheet1" with the actual name of your sheet...

That SHOULD work (And does)

Juan Pablo G.

Posted by Chris on December 26, 2001 1:51 PM

You have to replace "Sheet1" with the actual name of your sheet... That SHOULD work (And does)

I did that and it works when I run it within
the spreadsheet, but if I go to another sheet
and enter information then save the spreadsheet
while I am on another sheet then close out, then
I open the spreadsheet back up it goes to the sheet that I had open last. Is there some way to
run that code when I open up the spreadsheet?

Posted by Juan Pablo G. on December 26, 2001 1:59 PM

Where did you put the code ?

It should NOT go in a standard module. It should go in module of the book (Appears as ThisBook)

Juan Pablo G.

:I did that and it works when I run it within
:the spreadsheet, but if I go to another sheet
:and enter information then save the spreadsheet
:while I am on another sheet then close out, then
:I open the spreadsheet back up it goes to the
:sheet that I had open last. Is there some way to
:run that code when I open up the spreadsheet?

Posted by Chris on December 26, 2001 2:04 PM

It should NOT go in a standard module. It should go in module of the book (Appears as ThisBook) :I did that and it works when I run it within

Thanks that worked. Got one more question if you know. Can you have message boxes appear in excel?

Posted by Juan Pablo G. on December 26, 2001 2:05 PM

MsgBox "Like this ?"

Juan Pablo G. : Where did you put the code ? : It should NOT go in a standard module. It should go in module of the book (Appears as ThisBook) : :I did that and it works when I run it within