ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add a worksheet with a name as a date (https://www.excelbanter.com/excel-programming/279616-add-worksheet-name-date.html)

John G[_3_]

Add a worksheet with a name as a date
 
Hi all,

I use today() or now() to enter the current date into a cell. Then
today() is removed using Selection.PasteSpecial Paste:=xlPasteValues
leaving just the date.

I am now left with a date in the following format 15/10/03. I can
alter the format of this eg to 15th October 2003 but my problem is
that the underlying format remains the same.

This is a problem because when I create a worksheet using this date
(Sheets.Add.Name) I can not name a worksheet with the character / . I
know I can change my regional settings separator to something
different but then this will affect all my other excel programs.

I need to enter the system date (current) automatically so I can not
manually add as text the date.

Any thoughts would be appreciated.

Thanks,

John G

Rog[_2_]

Add a worksheet with a name as a date
 
Not totally sure what you're after, but have you
investigated the format function?

try this in the immediate window :

?now()

and then

?format(now(),"dd mmm yyyy")

you could then add a new worksheet like this :

set wkshtTemp=activeworkbook.Worksheets.Add
wkshtTemp.name="Sheet " & format(now(),"dd mmm yyyy")

anyway, I'm sure you can experiment

Regards

Rog


-----Original Message-----
Hi all,

I use today() or now() to enter the current date into a

cell. Then
today() is removed using Selection.PasteSpecial

Paste:=xlPasteValues
leaving just the date.

I am now left with a date in the following format

15/10/03. I can
alter the format of this eg to 15th October 2003 but my

problem is
that the underlying format remains the same.

This is a problem because when I create a worksheet using

this date
(Sheets.Add.Name) I can not name a worksheet with the

character / . I
know I can change my regional settings separator to

something
different but then this will affect all my other excel

programs.

I need to enter the system date (current) automatically

so I can not
manually add as text the date.

Any thoughts would be appreciated.

Thanks,

John G
.



All times are GMT +1. The time now is 09:14 AM.

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