Hi Kauri,
When you enter a date into Excel it is entered on the
basis of your Regional format, not by the format in a cell.
Excel will recognize that a month cannot be greater than 12
so if the month is greater than 12 then that must be the month
and it will swap your month and day of month. The result is you
have a mixture of dates some with correct dayofmonth and month
and some with them swapped.
Once a date is in Excel it uses your short date Regional format
unless you override it. If you override it and it has the same order
as your short regional date then Excel treats it as your Regional
date and you haven't really overridden the date..
If you send your worksheet to someone in the US with mm/dd/yyyy
(m/d/y) then they will see it in their format unless you overrode it.
If you really overrode it then they will see it as overridden unless
Excel simply recorded it at your end as (d/m/y) in which case it
will appear in the order (m/d/y) in the US.
In VBA all dates are treated as US dates, one of.
Stephen Bullen's chapters is on handling dates,
"Developing Excel applications for international clients "
which you will probably want to read if you stick to the
Excel 2002 or earlier version. Read about at
http://www.bmsltd.ie
The net result is that without you telling exactly what you have
and what coding you are using, we can't really give you a lot of
help. But from the sounds of it the damage is probably already
done within your source worksheet.
You can use formulas on the Worksheet such as
=DATE(YEAR(A1),MONTH(A1)+6,DAY(A1))
Particularly for testing you can remove ambiguity by
formatting with a 4 digit year and 3 character Month name.
dd mmm yyyy
or go with the ISO date format yyyy-mm-dd
unfortunately if you use the ISO date format you will also
want to use that order in your Regional short date format.
And you should find out what you actually have
=A1 format as dd mmm yyyy
In VBA it would be much safer to use such formulas
cell.value = DateSerial(year, month, day)
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages:
http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page:
http://www.mvps.org/dmcritchie/excel/search.htm