ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Re Name a Worksheet as a Date Format (https://www.excelbanter.com/excel-programming/291537-re-name-worksheet-date-format.html)

John D O'Connor

Re Name a Worksheet as a Date Format
 
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



Ron de Bruin

Re Name a Worksheet as a Date Format
 
Hi John

Use the Format function

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

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


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"John D O'Connor" wrote in message ...
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





Frank Kabel

Re Name a Worksheet as a Date Format
 
Hi John
try
strSheetName =
Format(Worksheets(ActiveSheet.Name).Range("a8"),"m mddyyyy")
apply the format code to your needs

--
Regards
Frank Kabel
Frankfurt, Germany

John D O'Connor wrote:
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



John D O'Connor

Re Name a Worksheet as a Date Format
 
Thanks Ron, works a treat

Rgds

John


"Ron de Bruin" wrote in message
...
Hi John

Use the Format function

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

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


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"John D O'Connor" wrote in message

...
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








All times are GMT +1. The time now is 09:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com