Fixing the date format in a macro or VBA

  • Thread starter Thread starter Geoff B
  • Start date Start date
G

Geoff B

I have created a macro of which part is to convert an incorrect date format,
dots instead of dashes, that works fine on my PC. (using Ctrl H to find and
replace . with / in the column)
Unfortunately when the macro is run on other machines the date format
becomes Americanised. And as such something like 08/05/09 becomes 05/08/09
which messes up other calculations done within the macro. The other machines
are set up as Australian so I am assuming the macro somehow loses its local
setting control when not being run on the authors machine.
Is there some way that I can lock the date format as Australian or as
dd/mm/yyyy within the macro?
--
 
Hi,

If you had your dates in column A then include this line after your macro
has done find/replace:

columns("A:A").numberformat = "dd/mm/yyyy"
 
Back
Top