Hi guys,
I hope you can help.
It should be something really simple.
I want a warning to appear when one activates certain sheets. I have tried the following, where I list the sheet names as follows:
If Sh.Name = "DataBase" Or "List" Then
But this gives me a Run-time error: 13 Type mismatch.
When a list a single sheet name as follows:
If Sh.Name = "DataBase" Then
it works fine.
Here is my code:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Sh.Name <> "DataBase" Then
MsgBox "You may use this sheet!"
Else
If Sh.Name = "DataBase" Or "List" Then
answer = MsgBox("Please use with caution!", vbOKCancel)
If answer = vbCancel Then
Sh.Visible = False
End If
End If
End If
End Sub
Thank you!
Bookmarks