If Active Sheet on Opening is X then do Y

  • Thread starter Thread starter spences10
  • Start date Start date
S

spences10

Hi, I'm having trouble with the below code. I want the open procedure
to exit the code if the active sheet on opening is "Option1" can
anyone help please??

Private Sub Workbook_Open()
Application.ScreenUpdating = False
If ActiveSheet.Name("Option1") Then
Exit Sub
End If
ActiveWorkbook.Sheets("Input").Activate
If Range("D30") <> "" Then
ActiveWorkbook.Sheets("Default").Select
Exit Sub
End If
UserForm2.Show
Application.ScreenUpdating = True
End Sub
 
Hi Galimi,

as instructed i entered the debug and the [same as before] following
error appeared : Run-Time Error '451'

Property let procedurenot defined and property get procedure did not
return an object

I'm totally lost....

Scott
 
Gary,

Excellent

Thats the one, Thank You

Gary''s Student said:
Private Sub Workbook_Open()
If ActiveSheet.Name = "Option1" Then
MsgBox ("because active sheet is Option1, I am leaving")
Exit Sub
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top