naming sheets

  • Thread starter Thread starter Guest
  • Start date Start date
Something like:

Sub dateit()
ActiveSheet.Name = Format(Date, "dd_mm_yyyy")
End Sub


change the format to suit your needs
 
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
 
so how would we get it to work?

thank you

Gary''s Student said:
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
 

Ask a Question

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.

Ask a Question

Back
Top