Fixing the date format in a macro or VBA

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?
--
 
S

Sam Wilson

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"
 

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