Automatically go to Worksheet upon opening

Toonloon

Board Regular
Joined
Dec 13, 2005
Messages
98
Hi All...

Upon opening, I want my Workbook to automatically go to a worksheet titled "Main Menu".

This workbook is shared out to multiple users.

The code i currently have in "ThisWorkbook" object is:
Private Sub Workbook_Open()
Sheets("Main Menu").Activate
Sheets("Main Menu").Range("A1").Activate
End Sub


This works, however, users are intermittently getting the error
"Run Time Error '1004'
Select method of Range class failed"


Any ideas/suggestions ?

Thanks a million.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Hi
One line is all you need
Code:
Private Sub Workbook_Open()
Sheets("Main Menu").Range("A1").Activate
End Sub
 
Upvote 0
Hi
One line is all you need
Code:
Private Sub Workbook_Open()
Sheets("Main Menu").Range("A1").Activate
End Sub

I think that will fail if Main Menu is not already the active sheet.

Try

Code:
Private Sub Workbook_Open()
Application.Goto Sheets("Main Menu").Range("A1"), True
End Sub
 
Upvote 0
Thanks for the replies lads,

Michael... i tried a lot of different permutations of the code, 1 line, 2 lines etc... but still got the error

However.....

I have not tried VoG's code..... so... here's fingers crossed....i probably won't find out for a while :)

Thanks a mill to both of ye
 
Upvote 0
Ah Well...

Just tried it out and got the error again.

Would the fact that the Workbook is shared out cause the error ?
 
Upvote 0
Would the fact that the Workbook is shared out cause the error ?

Almost certainly. You could avoid the error like this

Code:
Private Sub Workbook_Open()
On Error Resume Next
Application.Goto Sheets("Main Menu").Range("A1"), True
On Error GoTo 0
End Sub
 
Upvote 0
Sorry to jump on the back of this thread but thought that was better than starting a new thread as it relates to the same thing. I've used the code suggested by VoG above and it works like a treat, however upon opening I would also like to run a macro. Can you please expand on the code suggested so I can incorporate this too? The macro is called "PivotSec1".

Thanks

:)
 
Upvote 0
Try

Code:
Private Sub Workbook_Open()
Application.Goto Sheets("Main Menu").Range("A1"), True
Call PivotSec1
End Sub
 
Upvote 0
Hi VoG,

Thanks for speedy response, however I still get an error message. Basically I've got a pivot chart on the page that I want to open, however the page is password protected and I get an error message come up that says:

"That command cannot be performed while a protected sheet contains another PivotTable report based on the same source data"?

The macro I created was to unprotect the sheet, select the "use pivottable reports" option (as for some reason this doesn't save) then reprotect the sheet.

Any ideas how I can bypass this error message?

:)
 
Upvote 0

Forum statistics

Threads
1,224,564
Messages
6,179,547
Members
452,925
Latest member
duyvmex

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