ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Format date macro (https://www.excelbanter.com/excel-programming/380757-format-date-macro.html)

Dagonini

Format date macro
 
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!


Don Guillett

Format date macro
 
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

--
Don Guillett
SalesAid Software

"Dagonini" wrote in message
ups.com...
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!




Bob Phillips

Format date macro
 
Sounds like you are using

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


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"Dagonini" wrote in message
ups.com...
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!




Dagonini

Format date macro
 
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?


Bob Phillips wrote:
Sounds like you are using

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


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"Dagonini" wrote in message
ups.com...
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!






All times are GMT +1. The time now is 07:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com