SoS from middle east

marwa

New Member
Joined
May 22, 2011
Messages
4
hi every one
i'v a 22 sheets workbook i wanted 2 make the 1st one is the default one while opening i'v made this code:
Private Sub Workbook_Open()
Worksheets("sheet1").Activate
End Sub
( in this work book)
it's working but every time i open this file gives me this meassage :
runtime 9: subscript out of range
pleaaaaase answer meeee soooooooon:confused:
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Try this

Code:
Private Sub Workbook_Open()
Worksheets(1).Activate
End Sub
 
Upvote 0
Code:
Private Sub Workbook_Open()
    Sheets(2).Activate
End Sub
 
Upvote 0
Welcome to the MrExcel board!

pleaaaaase answer meeee soooooooon:confused:
Was 5 minutes soon enough? :biggrin:

Another option that also ensures the first sheet is scrolled to the top left (or modify if you want a different location) is:

<font face=Courier New><br><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Workbook_Open()<br>    Application.Goto Reference:=Sheets(1).Range("A1"), Scroll:=<SPAN style="color:#00007F">True</SPAN><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
 
Upvote 0

Forum statistics

Threads
1,224,508
Messages
6,179,189
Members
452,893
Latest member
denay

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