Activate Certain Sheet When Open a Workbook

qiqinuinaifen128

Board Regular
Joined
Dec 26, 2008
Messages
65
Dear Pros,

I have a question regarding the Excel VBA.
I have a workbook which has about 50 sheet. Is it possible to make the wookbook always activate sheet1 when the wookbook was open?

I know there is a private sub sth like below
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sub

But can anyone show me step by step how to do it. I am a beginner. I only know create macro and assign macro. So i don't know where to start although i find this code in internet.

I would appreciate if anyone can help me.
Thank you in advance and hope to hear from you soon.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Right click the Excel logo just to the left of File on the menu bar, select View Code and paste in

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

Then save, close and re-open the workbook to see the effect.
 
Upvote 0
Yeah, '07 has a much different interface. In '07 you can still hit ALT+F11 to open the VBE, then open the ThisWorkbook module. You can put Workbook level events, like Open, there (that's where Peter's code should go).

HTH,
 
Upvote 0
Hi,

Sorry to ask you stupic question. I am a beginner, can you guide me step by step. After i press ALT F11 and i see a window of VBA, the right site i can see the properties window, and i can see all my worksheet and my micro (Module), how should i go?
 
Upvote 0
You should see something like this:

vbe.jpg


Double click on ThisWorkbook and paste in the code.
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,731
Members
448,987
Latest member
marion_davis

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