I have this code:
This works well but I have a few problems.
1. If I click Cancel on the Input Box I get an error and it still adds a sheet anyway, just with no new name.
2. It has the macro button on the new sheet, ideally I would like this not to be copied over.
Can anyone figure out what I need to do to get this to work?
Thanks for any help, much appreciated
Code:
Sub move()
sn = InputBox("Enter Sheet Name")
ActiveSheet.Copy after:=ActiveWorkbook.Sheets(ActiveWorkbook.Sheets.Count)
ActiveSheet.Name = sn
MsgBox "New Sheet Added"
End Sub
This works well but I have a few problems.
1. If I click Cancel on the Input Box I get an error and it still adds a sheet anyway, just with no new name.
2. It has the macro button on the new sheet, ideally I would like this not to be copied over.
Can anyone figure out what I need to do to get this to work?
Thanks for any help, much appreciated