J
John D. Inkster
I have a macro that I use to make a copy of the active worksheet . It
works great, if I run the macro again with the same value in "f4", I
get a vb error. Is there a way to check the name in "f4" against all
worksheet names (there could be 50 sheets) and trap the error?
Dim my_sheet As String
my_sheet = Range("f4").Value
ActiveSheet.Copy After:=Sheets(1)
ActiveSheet.Name = my_sheet
I will then use:
MsgBox "Sheet Saved", vbOKOnly + vbExclamation
Else
MsgBox "Duplicate name Sheet Not Saved", _
vbOKOnly + vbExclamation
End If
End Sub
Thanks for any help!
John
works great, if I run the macro again with the same value in "f4", I
get a vb error. Is there a way to check the name in "f4" against all
worksheet names (there could be 50 sheets) and trap the error?
Dim my_sheet As String
my_sheet = Range("f4").Value
ActiveSheet.Copy After:=Sheets(1)
ActiveSheet.Name = my_sheet
I will then use:
MsgBox "Sheet Saved", vbOKOnly + vbExclamation
Else
MsgBox "Duplicate name Sheet Not Saved", _
vbOKOnly + vbExclamation
End If
End Sub
Thanks for any help!
John