Dateformat problem in Excel2003

S

Stefan Cruysberghs

Excel 2003 (Dutch version) seems to have a strange date problem. It is
always using a wrong date notation. I'm using a European dateformat, so
day/month/year. When I take a look at the notation of Excel, then it shows
month/day/year, so day and month are switched and notation is not the same
as the visible result. When creating a macro the problem can be reproduced.

Enter a date in European format, e.g. 25/03/2004 and record a macro.

Sub Macro1()
'
' Macro1 Macro
' De macro is opgenomen op 10/03/2004 door StefanCr.
'
Selection.NumberFormat = "[$-F800]dddd, mmmm dd, yyyy"
Selection.NumberFormat = "m/d/yyyy"
Selection.NumberFormat = "[$-F800]dddd, mmmm dd, yyyy"
Selection.NumberFormat = "d-mmm"
End Sub

Is this a bug ?
 
J

Jim Rech

I got the same results as you when I switched my Windows Control Panel
Regional Settings to Dutch. But I found that when I ran the recorded macro
the correct formatting was applied in the worksheet.

For example,

Selection.NumberFormat = "m/d/yyyy"

resulted in "10-3-2004" in the cell.

I think what is happening is that if you choose a date format that is one of
the asterisked ones in the Format Number dialog (marked with *), it is
"regionally aware".

--
Jim Rech
Excel MVP

| Excel 2003 (Dutch version) seems to have a strange date problem. It is
| always using a wrong date notation. I'm using a European dateformat, so
| day/month/year. When I take a look at the notation of Excel, then it shows
| month/day/year, so day and month are switched and notation is not the same
| as the visible result. When creating a macro the problem can be
reproduced.
|
| Enter a date in European format, e.g. 25/03/2004 and record a macro.
|
| Sub Macro1()
| '
| ' Macro1 Macro
| ' De macro is opgenomen op 10/03/2004 door StefanCr.
| '
| Selection.NumberFormat = "[$-F800]dddd, mmmm dd, yyyy"
| Selection.NumberFormat = "m/d/yyyy"
| Selection.NumberFormat = "[$-F800]dddd, mmmm dd, yyyy"
| Selection.NumberFormat = "d-mmm"
| End Sub
|
| Is this a bug ?
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top