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


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
Please help....Date Format issue SandyW Excel Discussion (Misc queries) 1 January 7th 09 07:29 PM
date format issue Arjen Excel Discussion (Misc queries) 3 August 22nd 06 02:04 PM
Date format issue CindyLF1 New Users to Excel 3 June 12th 06 06:18 PM
DATE FORMAT issue [email protected] Excel Worksheet Functions 1 February 8th 06 07:52 AM
Date format issue LadyDoe Excel Worksheet Functions 1 November 17th 05 07:54 AM


All times are GMT +1. The time now is 08:00 AM.

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"