D
DoctorV
I have the following code that works fine except for the line
If Sheets.Name = Sheets("MainForm").Range("b18").Value Then
What I want is to validate that if an existing Sheet name matches th
value in Sheets("MainForm").Range("b18").Value to give them a messag
box and cancel the sub.
What is the proper syntax to refer to check if a sheet name exists
Thanks a lot!!!
ActiveSheet.Protect DrawingObjects:=False, Contents:=False
Scenarios:=False
If Sheets.Name = Sheets("MainForm").Range("b18").Value Then
MsgBox "Sheet already exists"
Cancel = True
Else
Sheets("AllData").Select
Sheets("AllData").Copy Before:=Sheets(1)
Sheets("AllData (2)").Select
Sheets("AllData (2)").Name = Sheets("MainForm").Range("b18").Value
ActiveSheet.Activate
Application.Goto Reference:="R2:R64000"
Selection.ClearContents
Sheets("MainForm").Select
Range("A2").Select
'End If
ActiveSheet.Protect DrawingObjects:=True, Contents:=True
Scenarios:=True :
If Sheets.Name = Sheets("MainForm").Range("b18").Value Then
What I want is to validate that if an existing Sheet name matches th
value in Sheets("MainForm").Range("b18").Value to give them a messag
box and cancel the sub.
What is the proper syntax to refer to check if a sheet name exists
Thanks a lot!!!
ActiveSheet.Protect DrawingObjects:=False, Contents:=False
Scenarios:=False
If Sheets.Name = Sheets("MainForm").Range("b18").Value Then
MsgBox "Sheet already exists"
Cancel = True
Else
Sheets("AllData").Select
Sheets("AllData").Copy Before:=Sheets(1)
Sheets("AllData (2)").Select
Sheets("AllData (2)").Name = Sheets("MainForm").Range("b18").Value
ActiveSheet.Activate
Application.Goto Reference:="R2:R64000"
Selection.ClearContents
Sheets("MainForm").Select
Range("A2").Select
'End If
ActiveSheet.Protect DrawingObjects:=True, Contents:=True
Scenarios:=True :