+ Reply to Thread
Results 1 to 6 of 6

Make date entered in an InputBox UK format

  1. #1
    Co-op Bank
    Guest

    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. #2
    Tom Ogilvy
    Guest

    RE: 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. #3
    Bob Phillips
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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. #4
    Tom Ogilvy
    Guest

    Re: 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" <[email protected]> wrote in message
    > news:[email protected]...
    > > 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. #5
    Bob Phillips
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > 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. #6
    Tom Ogilvy
    Guest

    Re: 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" <[email protected]> wrote in message
    > news:[email protected]...
    > > 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" <[email protected]> wrote in message
    > > > news:[email protected]...
    > > > > 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1