Re Name a Worksheet as a Date Format

  • Thread starter Thread starter John D O'Connor
  • Start date Start date
J

John D O'Connor

Using a Macron how can you rename a Worksheet using a Date format. I have a
Macro that re-names a new Worksheet with whatever Date is in a certain cell,
however the worksheet re-names not in Date format but in numeric format.

Anyone suggest the code that I should insert? My current code is as below

strSheetName = Worksheets(ActiveSheet.Name).Range("a8")

Where A8 is the document date

Thanks

John
 
Hi John

Use the Format function

ActiveSheet.Name = Format(Range("B1"), "dd-mm-yy")

ActiveSheet.Name = Format(Now, "dd-mm-yy h-mm-ss")
 
Hi John
try
strSheetName =
Format(Worksheets(ActiveSheet.Name).Range("a8"),"mmddyyyy")
apply the format code to your needs
 
Thanks Ron, works a treat

Rgds

John


Ron de Bruin said:
Hi John

Use the Format function

ActiveSheet.Name = Format(Range("B1"), "dd-mm-yy")

ActiveSheet.Name = Format(Now, "dd-mm-yy h-mm-ss")
 

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