I want to write a macro by which I can change the date format fo
dd/mm/yyyy to mm/dd/yyyy.
How to do this
Bob Phillips - 27 Jan 2006 12:54 GMT
Why use a macro, why not just set the cell format to that?
--
HTH
Bob Phillips
(remove nothere from the email address if mailing direct)
> I want to write a macro by which I can change the date format fom
> dd/mm/yyyy to mm/dd/yyyy.
[quoted text clipped - 6 lines]
> reena's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=30440
> View this thread: http://www.excelforum.com/showthread.php?threadid=505689
Tom Ogilvy - 27 Jan 2006 15:19 GMT
but if you do want to set the format of a cell to mm/dd/yyyy with code, you
would use the numberformat property of the cell
Activecell.Numberformat="mm/dd/yyyy"
This will work if the underlying value in the cell is a date serial number.
If it is a text string, then no amount of formatting will change it. You
will need to parse out the components and rearrange them. Post back if
that is what you want.

Signature
Regards,
Tom Ogilvy
> I want to write a macro by which I can change the date format fom
> dd/mm/yyyy to mm/dd/yyyy.
>
> How to do this?