ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change date format (https://www.excelbanter.com/excel-programming/290465-change-date-format.html)

Warren

Change date format
 
Can someone please help?

The macro I am writing reads in a date from Cell A1, which is formatted as
dd/mm/yy. I want to create a new sheet with this date as the name. I know
that the sheet name cannot have "/" in it. The sheet is protected and I
cannot unprotect it.

So what is the code to read in this date and convert it to a text string in
the format of dd-mm-yy?

Thanks in advance

Warren



Hank Scorpio

Change date format
 
On Fri, 06 Feb 2004 04:01:20 GMT, "Warren" wrote:

Can someone please help?

The macro I am writing reads in a date from Cell A1, which is formatted as
dd/mm/yy. I want to create a new sheet with this date as the name. I know
that the sheet name cannot have "/" in it. The sheet is protected and I
cannot unprotect it.

So what is the code to read in this date and convert it to a text string in
the format of dd-mm-yy?


Format(Activesheet.Range("A1"), "DD-MM-YY")


---------------------------------------------------------
Hank Scorpio
scorpionet who hates spam is at iprimus.com.au (You know what to do.)
* Please keep all replies in this Newsgroup. Thanks! *

Tom Ogilvy

Change date format
 
sName = format(Range("a1").Value,"dd-mm-yy")
worksheets.Add
Activesheet.Name = sName

--
Regards,
Tom Ogilvy

Warren wrote in message
news:kkEUb.185726$5V2.902591@attbi_s53...
Can someone please help?

The macro I am writing reads in a date from Cell A1, which is formatted as
dd/mm/yy. I want to create a new sheet with this date as the name. I

know
that the sheet name cannot have "/" in it. The sheet is protected and I
cannot unprotect it.

So what is the code to read in this date and convert it to a text string

in
the format of dd-mm-yy?

Thanks in advance

Warren






All times are GMT +1. The time now is 04:25 PM.

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