Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I have this line of code Columns("A:A").NumberFormat = "m/d/yy" which should format the column as 8/23/03, but when I run it, it formats the column as 08/23/2003, when I look at the cell format after I run the code it is custom mm/dd/yyyy. I recorded a macro changing the format and got this Columns("A:A").Select Selection.NumberFormat = "m/d/yy" When I was recording it the dates changed to the right format but when I ran the macro it changed them to 08/23/2003, what is going on here? This happens in any workbook I run the code on. Thanks for any ideas -- Paul B Using Excel 2000 & 97 Please post any response to the newsgroups so others can benefit from it ** remove news from my email address to reply by email ** |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I think you got hit by a coincidence.
m/d/yy is what excel uses to represent windows short date format. If your windows short date format is mm/dd/yyyy, then you you use m/d/yy in excel, you'll get that short date format. In xl2002, it's documented at the bottom of the Format|Cells|Number Tab|Date category: Date formats display date and time serial numbers as date values. Except for items that have an asterisk (*), applied formats do not switch date orders with the operating system. And one of the entries with an asterisk is the short date format. Paul B wrote: I have this line of code Columns("A:A").NumberFormat = "m/d/yy" which should format the column as 8/23/03, but when I run it, it formats the column as 08/23/2003, when I look at the cell format after I run the code it is custom mm/dd/yyyy. I recorded a macro changing the format and got this Columns("A:A").Select Selection.NumberFormat = "m/d/yy" When I was recording it the dates changed to the right format but when I ran the macro it changed them to 08/23/2003, what is going on here? This happens in any workbook I run the code on. Thanks for any ideas -- Paul B Using Excel 2000 & 97 Please post any response to the newsgroups so others can benefit from it ** remove news from my email address to reply by email ** -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dave, thanks for the explanation
-- Paul B Using Excel 2000 & 97 Please post any response to the newsgroups so others can benefit from it ** remove news from my email address to reply by email ** "Dave Peterson" wrote in message ... I think you got hit by a coincidence. m/d/yy is what excel uses to represent windows short date format. If your windows short date format is mm/dd/yyyy, then you you use m/d/yy in excel, you'll get that short date format. In xl2002, it's documented at the bottom of the Format|Cells|Number Tab|Date category: Date formats display date and time serial numbers as date values. Except for items that have an asterisk (*), applied formats do not switch date orders with the operating system. And one of the entries with an asterisk is the short date format. Paul B wrote: I have this line of code Columns("A:A").NumberFormat = "m/d/yy" which should format the column as 8/23/03, but when I run it, it formats the column as 08/23/2003, when I look at the cell format after I run the code it is custom mm/dd/yyyy. I recorded a macro changing the format and got this Columns("A:A").Select Selection.NumberFormat = "m/d/yy" When I was recording it the dates changed to the right format but when I ran the macro it changed them to 08/23/2003, what is going on here? This happens in any workbook I run the code on. Thanks for any ideas -- Paul B Using Excel 2000 & 97 Please post any response to the newsgroups so others can benefit from it ** remove news from my email address to reply by email ** -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to update a column in a work based on another work sheet | New Users to Excel | |||
CELL FORMATTING WILL NOT WORK | Excel Discussion (Misc queries) | |||
Macro works Macro does not work | Excel Discussion (Misc queries) | |||
Will Conditional Formatting work? | Excel Worksheet Functions | |||
Time Formatting Does Not Work for me | Excel Discussion (Misc queries) |