+ Reply to Thread
Results 1 to 6 of 6

can't get error message box not to show if no error or to loop back to macro if there is a

  1. #1
    Registered User
    Join Date
    10-18-2008
    Location
    michigan
    MS-Off Ver
    2010
    Posts
    88

    can't get error message box not to show if no error or to loop back to macro if there is a

    Hi,
    In A column, I have dates that were put in with a macro then formatted m/dd/yyyy . No dates anywhere else.

    I’m trying to have an input box find a date and use a message box on an error
    This macro will find the date if the input is in the proper format but the error box will come up anyway. The macro ends with either choice (yes/no)
    If there is an error (wrong format or no date, the error box comes up and the macro ends with either choice (yes/no)

    If no date, I’d like a message box to say so and ask for another try or end
    If wrong format, I’d like the input to change to the proper format, or an error box coming up to change the format

    If no error, I don’t need an error box
    HTML Code: 
    Mike

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,891

    Re: can't get error message box not to show if no error or to loop back to macro if there

    After errorline, add check for error number.

    Something like...
    Please Login or Register  to view this content.
    Last edited by CK76; 12-08-2016 at 02:17 PM.

  3. #3
    Forum Contributor
    Join Date
    07-23-2016
    Location
    Texas
    MS-Off Ver
    2016
    Posts
    273

    Re: can't get error message box not to show if no error or to loop back to macro if there

    If you want the message to be displayed for a Null String, then you need to trigger an error if it is a null string rather than exit the sub.

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,891

    Re: can't get error message box not to show if no error or to loop back to macro if there

    No need to trigger an error. You can just display messagebox when Null string then exit sub if needed.
    Something like...
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-23-2016
    Location
    Texas
    MS-Off Ver
    2016
    Posts
    273

    Re: can't get error message box not to show if no error or to loop back to macro if there

    can use goto or error to allow using only one message box...that way if you want to change the message, you only need to change one.

  6. #6
    Registered User
    Join Date
    10-18-2008
    Location
    michigan
    MS-Off Ver
    2010
    Posts
    88

    Re: can't get error message box not to show if no error or to loop back to macro if there

    Hi all,

    I’m still self learning about macros. I made this macro by looking at excel help here and sites that don’t answer questions.
    If the input is formatted correctly and the date can be found, the cursor will go to the proper date BUT the error message box also comes up. Either option in the box will close it.
    If the input is formatted wrong or no date exists, the error message box comes up and again either option in the box will close it.
    The date is put in with an open macro that uses
    HTML Code: 
    What I would like is if the input is formatted wrong or no date exists, and yes is clicked in the error message box, the input box comes up again to be tried again.

    OR, an error message box comes up with why the date can’t be found and the input box comes up to try again.
    I don't need the error box come up if the date can be found.
    I noticed that somehow I made a mistake with the name of the macro I wanted called if the yes/no case in the error box is yes. “findqdate” shouldn’t have the “q” in it.

    Here is the macro I’m trying to fix
    HTML Code: 

+ 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] On error, ignore error but show message box
    By chin67326 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-18-2015, 07:54 PM
  2. [SOLVED] Error Message with For Loop
    By jadown in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-12-2013, 04:22 PM
  3. Stop a Macro if Criteria not met and Show Error Message
    By m3hool in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-17-2013, 10:12 AM
  4. Want to do a while-loop but get error message: run error '6' overflow
    By danzi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-07-2011, 01:48 PM
  5. Run the Macro if cell value is YES, else show error message.
    By acsishere in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-14-2008, 02:03 AM
  6. Going back to a form after a error message
    By raw in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-02-2006, 07:16 PM
  7. Error message when using the Solver in a VBA macro loop
    By Mathieu Fournier in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-01-2005, 11:06 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