Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date formate

Status
Not open for further replies.

wuwang

Programmer
May 16, 2001
48
US
Hello,

I have a date format issue in Excel 97 and Excel 2000.
I want to have the date output like 11-08 in both 97 and 2000. But when I put the code
char(34) & table("column") & char(34),
the output in 97 is 11-Aug i.s.o. 11-08.

How can I have the date output like 11-08 in 97?

Thanks for your help.
 
What about using a custom format for the cell(s):
mm-dd (or dd-mm)?
 
Thank you very much for your input.
I'm not quite understand what you said. Could you be
more specific?

Thanks
 
wuwang,
I think what snyderj is trying to say is goto Format - Cell. Select the Number tab and scroll down to Custom. Now under Type put in mm-dd or dd-mm, not sure which way you want.
 
Well, I can't give you EXACT code, but the best thing to use is the
Code:
NumberFormat
propery of a range. You can select a range or individual cell and change the format with VBA code. Here's what it would look like:
Code:
'To format an individual cell
ActiveSheet.Range("A1").NumberFormat = "dd-mm"

'To format an entire range
Dim MyRange as Range
     'Selects an entire column
Set MyRange = Range(Range("A1"), Range("A1").End(xlDown))
MyRange.NumberFormat = "dd-mm"
As you can probably guess, "m" stands for Month, "d" stands for Day, and "y" would stand for Year. If you had 3 "m"'s, you would see the abbreviated Month (Aug, Sep, Nov, etc). Look into this and see if it might suit your needs.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top