PDA

View Full Version : Solved: Getting a VBA-Created Date to Format Correctly



Cyberdude
04-13-2005, 09:38 AM
I am using VBA to create a new sheet, then populate it with data. As an afterthought, I decided to add a revision date:

Range("A1") = Format(Date,"mmm d, yy")
Well, it writes the date, but the format is 13-Apr-05.
I know I can go into Excel and format it correctly, but why doesn't the VBA Format function do it for me?? :dunno

Jacob Hilderbrand
04-13-2005, 09:41 AM
Well, you are just putting the value in the cell. Regardless of the format you enter it as, it will still be formatted based on the cell's specific formatting.


Range("A1") = Date
Range("A1").NumberFormat = "mmm d, yy"

Cyberdude
04-13-2005, 09:51 AM
Thanx, DRJ ... I knew I was missing something.

Jacob Hilderbrand
04-13-2005, 10:21 AM
You're Welcome :beerchug:

Take Care