Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Having problem getting date into format: yyyy/mm/dd
I am trying to format the contents of a cell to display
the date in the format: yyyy/mm/dd Right now in the code I have: OutputSheet.Cells(OutputRowCounter - NumTrans - 2, 5).Value = Format(Input1Sheet.Cells(2, 4).Value, "yyyy/mm/dd") What ends up happening is that it formats the variable properly, but when it writes it to the cell Excel changes the date back to mm/dd/yyyy. How do I get my change to stick? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Having problem getting date into format: yyyy/mm/dd
XL will still parse whatever string VBA hands it (just as if you
typed it in), then display the value per the cell's format, so Format() won't be effective. One way: With OutputSheet.Cells(OutputRowCounter - NumTrans - 2, 5) .Value = Input1Sheet.Cells(2, 4).Value .NumberFormat = "yyyy/mm/dd" End With In article , "Andrew" wrote: I am trying to format the contents of a cell to display the date in the format: yyyy/mm/dd Right now in the code I have: OutputSheet.Cells(OutputRowCounter - NumTrans - 2, 5).Value = Format(Input1Sheet.Cells(2, 4).Value, "yyyy/mm/dd") What ends up happening is that it formats the variable properly, but when it writes it to the cell Excel changes the date back to mm/dd/yyyy. How do I get my change to stick? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Format date dd.mm.yyyy to dd/mm/yyyy | Excel Discussion (Misc queries) | |||
change date format from dd/mm/yyyy to mm/yyyy | Excel Discussion (Misc queries) | |||
change date format dd/mm/yyyy to Julian date format? | Excel Worksheet Functions | |||
Help with date format mm/dd/yyyy vs. dd/mm/yyyy | Excel Discussion (Misc queries) | |||
how do I change date from mm/dd/yyyy to dd:mm:yyyy format in Excel | New Users to Excel |