+ Reply to Thread
Results 1 to 5 of 5

Input Box Date validation loop

  1. #1
    Forum Contributor
    Join Date
    01-20-2014
    Location
    Greece
    MS-Off Ver
    20 yr. old Excel 2002!
    Posts
    710

    Input Box Date validation loop

    Hi.
    I need an input box where the user enters a date in format yyyy-mm-dd OR yyyy/mm/dd (all 4 digits of year entered and single numbered days and months must have a leading 0).
    This date must be greater than sheet1 N1.
    The valid entry of the input box will be stored in sheet 1 O1.
    If a valid entry is not entered the input box will persist! (No cancel choice).

    Thanks

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Input Box Date validation loop

    User can enter the date in any valid date format. The code will format the entry to "yyyy-mm-dd"
    The cancel button is present but doesn't allow canceling.


    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    01-20-2014
    Location
    Greece
    MS-Off Ver
    20 yr. old Excel 2002!
    Posts
    710

    Re: Input Box Date validation loop

    Great!
    I 've got 2 questions.

    1. On my machine, I am using date format yyyy-mm-dd. If I run this on a machine of another locale where the date format is dd-mm-yyyy, will there be a problem?
    That is, will the date in O1 be stored in yyyy-mm-dd or dd-mm-yyyy?

    2. Just for testing today's date in d/m/yy, 4/2/17 is not accepted on my machine.

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Input Box Date validation loop

    This will use the user's system date format. So it will change depending on the users locale.

    The format of the date displayed in cell O1 will be whatever you set the cell formatting to. You could also set it to a generic Short Date format and it would use the user's system setting. The code works independent of the O1 cell formatting.


    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    01-20-2014
    Location
    Greece
    MS-Off Ver
    20 yr. old Excel 2002!
    Posts
    710

    Re: Input Box Date validation loop

    Very Good, thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 08-11-2016, 09:28 PM
  2. Data Validation - Need a date or specific text to be input
    By garethmckeeveraxa in forum Excel General
    Replies: 2
    Last Post: 04-25-2016, 05:54 AM
  3. User Input Date Loop Macro
    By Coeus in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-16-2013, 06:59 PM
  4. [SOLVED] Input date via use of input box with validation
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-22-2013, 11:43 PM
  5. [SOLVED] Input Box, Confirm yes/no, if answer = no, loop back to input box
    By lukasj13 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-30-2012, 12:41 PM
  6. Validation- if date input is a Sunday
    By johnnywinter in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-24-2009, 09:05 PM
  7. Data from Input Box overrides cell input validation
    By Winon in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-01-2007, 02:29 PM

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