Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Another Date Format issue
Hi, I'm new to this forum and find it very useful. Thanks to all those wh give advise and to all those who ask questions. I have another date issue. The date is entered in an Input box. Th variable is formated as "dd/mm/yy". The Excel spreadsheet and th regional seetings are set to the same. However if the first 2 numbers entered in the input box are less tha 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 th Excel spreadsheet. ie Enter 21/10/03; output as 21/10/03. Code as follows: ComD = InputBox("Please enter " & CtlNm & " Completio 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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Please help....Date Format issue | Excel Discussion (Misc queries) | |||
date format issue | Excel Discussion (Misc queries) | |||
Date format issue | New Users to Excel | |||
DATE FORMAT issue | Excel Worksheet Functions | |||
Date format issue | Excel Worksheet Functions |