Format date macro

D

Dagonini

I tried to make a macro to format the date into the configuration I
need. It is going from 01/01/2007 to 2007-01-01

It is part of a larger macro that does a host of things but this part
was:

Columns("M:M").Select
Selection.NumberFormat = "yyyy-mm-dd"

Columns("J:J").Select
Selection.NumberFormat = "yyyy-mm-dd"

however, when I run the macro the date comes out as 01-01-tuesday.
Does any one know what might be happening here and how i can fix it?

Thanks!
 
D

Don Guillett

I just used this from your old format to this and it worked just fine.

Sub newdateformat()
Range("j1,m1").EntireColumn.NumberFormat = "yyyy-mm-dd"
End Sub
 
B

Bob Phillips

Sounds like you are using

Columns("M:M").Select
Selection.NumberFormat = "yyyy-mm-dddd"


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)
 
D

Dagonini

I'm still having problems. Could it be that I am not saving correctly
because I am saving as a .CSV? Does a .CSV file not always keep the
formatting?
 

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