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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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,222,095
Messages
6,163,904
Members
451,865
Latest member
dunworthc

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