auto open a particular worksheet when workbook opened

racheljane

New Member
Joined
Jul 31, 2007
Messages
9
Hi,
Can anyone tell me the vba code to automatically open sheet one when a workbook is opened? At the moment it opens on the page on which the workbook was last saved.
Thanks
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi There

Welcome to the board

Code:
Private Sub Workbook_Open()
Sheet1.Activate
End Sub

Ought to do it.

KR


Dave
 
Upvote 0
thanks but it still opens up on the last saved page - is there something else I need to do? I'm quite new to vba. I've just saved this code in a module called auto_open. All the other macros I've recorded need a button to be pressed to activate them. ????
 
Upvote 0
I've just saved this code in a module called auto_open.
That's the problem.

In the Visual Basic window, double click on "This Workbook" and paste the code there.

If that doesn't work, try changing the middle line to
Sheets("Sheet1").Activate
 
Upvote 0
Sorry to be a pain - it still doesn't work??? If I double click in the vba window on 'this workbook', it just opens all the modules that I have.
 
Upvote 0
Hi RachelJane,

At the top of excel where you have a command menu File Edit etc you will see a little excel icon in the top left next to 'File'

Right click this and choose view code.

Paste the code in there!

Also another thought...Is your sheet called Sheet1?

If not replace sheet1 with your sheet name:

Code:
Private Sub Workbook_Open() 
Sheets("Mysheetnamehere").Activate
End Sub
 
Upvote 0
HI AdamC

It doesn't give me the option view code, only save or import file. Thanks for your patience!
Rachel
 
Upvote 0
Hi Rachel.

Thats because you are right clicking on the visual basic editor commandbars. :biggrin:

Return to excel so your sheet is visible then repeat as above.

Let me know if this helps
 
Upvote 0
Rachel,

Your very welcome, no need to apologise, if it wasnt for this forum id also be DIM! :biggrin:
 
Upvote 0

Forum statistics

Threads
1,214,645
Messages
6,120,711
Members
448,984
Latest member
foxpro

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top