Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Format date dd.mm.yyyy to dd/mm/yyyy Kiwi User Excel Discussion (Misc queries) 7 May 7th 23 11:44 AM
change date format from dd/mm/yyyy to mm/yyyy flow23 Excel Discussion (Misc queries) 3 April 4th 23 11:26 AM
change date format dd/mm/yyyy to Julian date format? itzy bitzy Excel Worksheet Functions 1 December 8th 09 07:42 PM
Help with date format mm/dd/yyyy vs. dd/mm/yyyy Dream Excel Discussion (Misc queries) 3 September 10th 09 07:33 PM
how do I change date from mm/dd/yyyy to dd:mm:yyyy format in Excel Jack Wilson New Users to Excel 4 July 18th 06 01:57 PM


All times are GMT +1. The time now is 04:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"