+ Reply to Thread
Results 1 to 2 of 2

Not sure how to finish an isDate error checking problem without jumping out of subroutine

  1. #1
    Registered User
    Join Date
    04-20-2012
    Location
    Oneida, NY
    MS-Off Ver
    Excel 2010
    Posts
    42

    Not sure how to finish an isDate error checking problem without jumping out of subroutine

    I am using a user form to input a date into a spreadsheet. The form has a textbox and an OK button. I use the user form initiate subroutine to initially fill the textbox with a date, and I use the OKButton click subroutine to check that the information in the textbox is a date using the Isdate statement. If it is not a date then I use a msgbox to notify me that the date is wrong. My problem is what to do next. I want to put the original date back in the textbox and have the person try re-entering a new date if they wish but I don't know how to jump back to the point before the IsDate statement that would work without jumping to another subroutine that may not bring me back to this subroutine. Just need some guidance on how to do that. I have pasted below the code I am currently using.

    Please Login or Register  to view this content.
    Thanks

    Dan

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: Not sure how to finish an isDate error checking problem without jumping out of subrout

    Just reassign the value and use exit sub like this (though a better strategy would be to use a calendar control that will only return a date)

    Please Login or Register  to view this content.
    Last edited by Bernie Deitrick; 05-08-2014 at 09:51 AM.
    Bernie Deitrick
    Excel MVP 2000-2010

+ 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. Excel VBA subroutine overflow bug problem
    By hugoflores10 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-28-2014, 05:21 AM
  2. Error 1004 in Generate trackers subroutine
    By Mevans599 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-10-2014, 07:13 AM
  3. Version Checking Subroutine help
    By chinaboy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-24-2012, 03:18 PM
  4. Error in Workbook Open subroutine
    By matpj in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-25-2007, 05:11 AM
  5. looping when checking isdate
    By april27 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-16-2006, 08:50 AM

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