How to open a specific worksheet via code from workbook_open
This is the code i'm using that gets a runtime error application defined or
object defined error:-
If ActiveSheet.Name = Worksheets("sheet1").Range("c5") Then
MsgBox "Already here on... " & ActiveSheet.Name
Else
'MsgBox "Not here!"
Worksheets(Worksheets("sheet1").Range("c5").Value) .Activate
End If
Hope you guys can help!
"Martin Parker" wrote:
Thanks that works great, however, one problem, if the user has previously
closed the app on the worksheet the code is referring to, I get a runtime
error on workbook open.
How would i code to check if the worksheet requested to open up at workbook
open is already activated?
Hope this makes sense!
Cheers
"JLatham" wrote:
Worksheets(Worksheets("sheet1").Range("c5").Value) .Activate
"Martin Parker" wrote:
I have a combobox which is populated with all the worksheets within the
workbook. The controlsource of the combobox is linked to cell c5 on Sheet1
My question is how do i make the Excel workbook open at the worksheet which
is detailed within the combobox linked cell.
I've been previously using in the Workbook_Open procedu-
Worksheets(Worksheets("sheet1").Range("c5").Value)
but the above code doesnt seem to work.
Hope you can help!
Cheers
|