Command Buttons - VBA
Posted by Joe on December 08, 2000 9:45 AM
I have command buttons that go to certain worksheets and I want to Error proof them. Is there a VBA code that will check to see if that worksheet exists and if not return a message that it doesn't. This is what I have at this point:
Private Sub CommandButton1_Click()
Dim y As String
Dim x As Object
y = "Item Master"
Set x = ActiveWorkbook.Sheets(y)
If x <> "" Then
Worksheets("Item Master").Activate
Else
MsgBox ("Worsheet Item Master does not exist. Please run macro on Summary Engine worksheet.")
Exit Sub
End If
End Sub