Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Make date entered in an InputBox UK format

Hi,

I have a simple InputBox in excel which keys in a date into a single cell.
But when I key in 01/04/2006 the inputbox interprets the date to be 4th Jan
2006 rather than 1st April 2006.

is there anyway I can change this so it uses the English date format rather
than US?

Please help!
Thanks
Brian
Manchester,England
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Make date entered in an InputBox UK format

Dim dt as Date, s as String
s = Inputbox("enter date")

dt = cdate(s)

Range("b9").Value = dt

Cdate will interpret your string according to regional settings. It is
always best to convert to and work with dateserial numbers as soon possible.

--
Regards,
Tom Ogilvy


"Co-op Bank" wrote:

Hi,

I have a simple InputBox in excel which keys in a date into a single cell.
But when I key in 01/04/2006 the inputbox interprets the date to be 4th Jan
2006 rather than 1st April 2006.

is there anyway I can change this so it uses the English date format rather
than US?

Please help!
Thanks
Brian
Manchester,England

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Make date entered in an InputBox UK format

Declare the variable as type date

Dim ans As Date
ans = InputBox("Please supply date")
Range("H5").Value = ans


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Co-op Bank" wrote in message
...
Hi,

I have a simple InputBox in excel which keys in a date into a single cell.
But when I key in 01/04/2006 the inputbox interprets the date to be 4th

Jan
2006 rather than 1st April 2006.

is there anyway I can change this so it uses the English date format

rather
than US?

Please help!
Thanks
Brian
Manchester,England



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Make date entered in an InputBox UK format

Bob,
being in the UK, this doesn't cause the same problem for an ambiguous date
like

10/04/2006 (April 10, 2006)

--
Regards,
Tom Ogilvy


"Bob Phillips" wrote:

Declare the variable as type date

Dim ans As Date
ans = InputBox("Please supply date")
Range("H5").Value = ans


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Co-op Bank" wrote in message
...
Hi,

I have a simple InputBox in excel which keys in a date into a single cell.
But when I key in 01/04/2006 the inputbox interprets the date to be 4th

Jan
2006 rather than 1st April 2006.

is there anyway I can change this so it uses the English date format

rather
than US?

Please help!
Thanks
Brian
Manchester,England




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Make date entered in an InputBox UK format

It does seem to resolve it Tom. I always used to CDate it as you suggested,
but I tried this one time, and it seems to work.

For instance, if I enter 05/04/2006, with a non-declared data type, stepping
through the code shows 05/04/2006 at all stages, and then changes it to
04/05/2006 (4th May here) when loading into a cell. Using a date type, it
stays as 05/04/2006 all the way thrugh.

Bob

"Tom Ogilvy" wrote in message
...
Bob,
being in the UK, this doesn't cause the same problem for an ambiguous date
like

10/04/2006 (April 10, 2006)

--
Regards,
Tom Ogilvy


"Bob Phillips" wrote:

Declare the variable as type date

Dim ans As Date
ans = InputBox("Please supply date")
Range("H5").Value = ans


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Co-op Bank" wrote in message
...
Hi,

I have a simple InputBox in excel which keys in a date into a single

cell.
But when I key in 01/04/2006 the inputbox interprets the date to be

4th
Jan
2006 rather than 1st April 2006.

is there anyway I can change this so it uses the English date format

rather
than US?

Please help!
Thanks
Brian
Manchester,England








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Make date entered in an InputBox UK format

That is good to know. Thanks.

--
Regards,
Tom Ogilvy



"Bob Phillips" wrote:

It does seem to resolve it Tom. I always used to CDate it as you suggested,
but I tried this one time, and it seems to work.

For instance, if I enter 05/04/2006, with a non-declared data type, stepping
through the code shows 05/04/2006 at all stages, and then changes it to
04/05/2006 (4th May here) when loading into a cell. Using a date type, it
stays as 05/04/2006 all the way thrugh.

Bob

"Tom Ogilvy" wrote in message
...
Bob,
being in the UK, this doesn't cause the same problem for an ambiguous date
like

10/04/2006 (April 10, 2006)

--
Regards,
Tom Ogilvy


"Bob Phillips" wrote:

Declare the variable as type date

Dim ans As Date
ans = InputBox("Please supply date")
Range("H5").Value = ans


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Co-op Bank" wrote in message
...
Hi,

I have a simple InputBox in excel which keys in a date into a single

cell.
But when I key in 01/04/2006 the inputbox interprets the date to be

4th
Jan
2006 rather than 1st April 2006.

is there anyway I can change this so it uses the English date format
rather
than US?

Please help!
Thanks
Brian
Manchester,England






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
Make Day CAPS In Custom Date Format robzrob Excel Worksheet Functions 8 February 25th 10 08:48 PM
Excel 2002: How to make the date format uniform ? Mr. Low Excel Discussion (Misc queries) 1 November 20th 08 04:56 PM
Condit Format? Make date change colors tkg Excel Worksheet Functions 6 February 13th 07 07:21 PM
How to make xy plot of date format data in both columns Pardeep Mohan Charts and Charting in Excel 1 August 30th 06 09:13 AM
how do i make a value entered be * 2 BigAL921 New Users to Excel 1 December 21st 05 06:45 AM


All times are GMT +1. The time now is 10:23 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"