+ Reply to Thread
Results 1 to 4 of 4

Date in userform error message not working

  1. #1
    Registered User
    Join Date
    11-15-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    41

    Date in userform error message not working

    Hi all,

    I've got a userform which populates the next available row in an excel spreadsheet.

    There are 2 boxes on my userform which require dates to be entered. Therefore I attempted to put them in as a date value and put an error message on when a date format is not used for entry. However the error code does not appear when the date is entered incorrectly, I just get asked to debug the code. It works fine when the date is entered correctly.

    The code is below for the OK button (ie the populate the spreadsheet button). The Date box 1 is called txtDateToday and the Date box 2 is called txtDateExpected.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Date in userform error message not working

    Hi Cath

    Try using Exit Events for your TextBoxes that Format the Date as you require, for example
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    11-15-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    41

    Re: Date in userform error message not working

    Hi,

    Thanks for responding! That code works nicely, thank you

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Date in userform error message not working

    You're welcome...glad I could help...Thanks for the Rep.

    If this resolves your issue please mark your Thread as SOLVED.

    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:
    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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. [SOLVED] No error message but Code not working
    By mukeshbaviskar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-19-2013, 01:12 PM
  2. Creating and error Message Userform
    By fredlo2010 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-25-2013, 11:20 PM
  3. Error Message When Textbox in Userform Left Blank
    By zaclim78 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-07-2012, 12:19 PM
  4. [SOLVED] Method 'Range' of object '_Global' failed error message on running userform when another
    By sivakumar123 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-01-2012, 11:39 AM
  5. UserForm with Error Message
    By 00Able in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-14-2011, 04:52 AM

Tags for this Thread

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