I have this code to add asheet with a2 as the date is it possible to do it
this way
Sub AddNewSheet()
Dim SheetName As String
SheetName = Range("A2")
Sheets(5).copy After:=Sheets(Sheets.Count)
On Error GoTo ErrHandler:
ActiveSheet.Name = SheetName
Exit Sub
ErrHandler:
MsgBox SheetName & " is not a valid sheet name or is already used."
End Sub
Your approach can be made to work. However, as you pointed out in the code,
you need to do an error check in case Range("A2").Value is not a legal
sheetname or has aleady been used
Your approach can be made to work. However, as you pointed out in the code,
you need to do an error check in case Range("A2").Value is not a legal
sheetname or has aleady been used
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.