Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Entering dates in vba inputbox as ddmmyy. Excel returns mmddyy

I am using an inputbox in VBA to return a date into an excel cell. When I
enter the date as dd mm yy, excel returns it as mm dd yy, irrespective of how
I have formatted the receiving cell. It only applies to the lower numbers
such as 06/07/05. If I were to enter 25/07/05, it would return correctly.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Entering dates in vba inputbox as ddmmyy. Excel returns mmddyy

You must be in the UK or Europe.

In VBA, all dates are treated as US style dates. Obviously, 25/07/2005 is
unambiguous, but 06/07/2005 isn't, so VBA treats it as US style.

You can force it rather than use the VBA default date casting, using CDate,
example

activecell.Value = cdate(inputbox("Input date"))


--

HTH

RP
(remove nothere from the email address if mailing direct)


"pkeegs" wrote in message
...
I am using an inputbox in VBA to return a date into an excel cell. When I
enter the date as dd mm yy, excel returns it as mm dd yy, irrespective of

how
I have formatted the receiving cell. It only applies to the lower numbers
such as 06/07/05. If I were to enter 25/07/05, it would return correctly.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Entering dates in vba inputbox as ddmmyy. Excel returns mmddyy

Thanks Bob, that was spot-on

"Bob Phillips" wrote:

You must be in the UK or Europe.

In VBA, all dates are treated as US style dates. Obviously, 25/07/2005 is
unambiguous, but 06/07/2005 isn't, so VBA treats it as US style.

You can force it rather than use the VBA default date casting, using CDate,
example

activecell.Value = cdate(inputbox("Input date"))


--

HTH

RP
(remove nothere from the email address if mailing direct)


"pkeegs" wrote in message
...
I am using an inputbox in VBA to return a date into an excel cell. When I
enter the date as dd mm yy, excel returns it as mm dd yy, irrespective of

how
I have formatted the receiving cell. It only applies to the lower numbers
such as 06/07/05. If I were to enter 25/07/05, it would return correctly.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Entering dates in vba inputbox as ddmmyy. Excel returns mmddyy

I'm in the UK myself, so I suffer these problems :-)

Bob


"pkeegs" wrote in message
...
Thanks Bob, that was spot-on

"Bob Phillips" wrote:

You must be in the UK or Europe.

In VBA, all dates are treated as US style dates. Obviously, 25/07/2005

is
unambiguous, but 06/07/2005 isn't, so VBA treats it as US style.

You can force it rather than use the VBA default date casting, using

CDate,
example

activecell.Value = cdate(inputbox("Input date"))


--

HTH

RP
(remove nothere from the email address if mailing direct)


"pkeegs" wrote in message
...
I am using an inputbox in VBA to return a date into an excel cell.

When I
enter the date as dd mm yy, excel returns it as mm dd yy, irrespective

of
how
I have formatted the receiving cell. It only applies to the lower

numbers
such as 06/07/05. If I were to enter 25/07/05, it would return

correctly.





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
how can I change MMDDYY to YYYYMMDD? mhayes Excel Discussion (Misc queries) 2 April 21st 10 11:11 PM
Convert mm/dd/yyyy to mmddyy Annette Excel Discussion (Misc queries) 9 September 22nd 09 09:39 PM
how do i format date to DDMMYY Maz Excel Discussion (Misc queries) 2 August 23rd 07 11:07 AM
Entering DATEs in EXCEL should not require use of "/" slashes. Receptionist Excel Discussion (Misc queries) 1 September 12th 05 05:11 PM
Entering dates in Excel 2002 DickG Excel Discussion (Misc queries) 3 January 9th 05 02:56 PM


All times are GMT +1. The time now is 10:18 PM.

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

About Us

"It's about Microsoft Excel"