View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Neil[_11_] Neil[_11_] is offline
external usenet poster
 
Posts: 43
Default Another Date Format issue

Wayne,

Use cdate instead of format
RepDa.Cells(Rw, 7).Value = CDate(ComD)

Neil

"Wayne Nelson" wrote in message
...

Hi,
I'm new to this forum and find it very useful. Thanks to all those who
give advise and to all those who ask questions.
I have another date issue. The date is entered in an Input box. The
variable is formated as "dd/mm/yy". The Excel spreadsheet and the
regional seetings are set to the same.
However if the first 2 numbers entered in the input box are less than
13, VBA assumes its a month. The value becomes "mm/dd/yy"
ie Enter 12/10/03, output as 10/12/03
If the first 2 numbers are 12, the correct date is entered in the
Excel spreadsheet.
ie Enter 21/10/03; output as 21/10/03.

Code as follows: ComD = InputBox("Please enter " & CtlNm & " Completion
Date.", "COMPLETION DATE:")

RepDa.Cells(Rw, 7).Value = Format(ComD, "dd/mm/yyyy")


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to

creating financial statements