+ Reply to Thread
Results 1 to 8 of 8

Error Handling - make macro more user friendly

  1. #1
    Registered User
    Join Date
    04-05-2014
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    10

    Error Handling - make macro more user friendly

    Hi,

    Thank you so much to all who have helped me out so far. I currently have a macro that allows the user to input numbers that will populate an excel sheet. The only problem is when they spell something wrong or enter something in the wrong format the macro will crash and give them an error. Basically I'm trying to program that if an error occurs, allow the user to repeat the last step and input a new value. I've attached my workbook and code below. I'm still relatively new to VBA, any help would be appreciated. Thank you FindDateBoxMacro.xlsm

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Error Handling - make macro more user friendly

    To take care of the error you need to check if RowIDX and ColumnIDX have values before you ask for user input here.
    Please Login or Register  to view this content.
    You could do that with this.
    Please Login or Register  to view this content.
    As for repeating the last step, what step(s) do you actually mean?
    If posting code please use code tags, see here.

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    13,042

    Re: Error Handling - make macro more user friendly

    The month popup should be inside the DO loop:
    Please Login or Register  to view this content.
    Ben Van Johnson

  4. #4
    Registered User
    Join Date
    04-05-2014
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Error Handling - make macro more user friendly

    Thanks for the replies guys. What I meant was for the line
    Please Login or Register  to view this content.
    If I leave it blank, type in letters/words or type in a box number that is not there; The macro will continue to run to the end and give an error because it won't have the proper indexes. Most of the time this won't be a problem, but time to time I expect the user might mistype something and I don't want the macro to crash.

    Basically I want to check that for every input; the macro will know what to perform for all cases such as:
    If the user accidently leaves the BxNumber empty, the macro crashes.
    If the user mistypes a date like 5/1/14 in the April tab, the value won't be inputted because it can't find the date; the macro will crash

    You guys have been a great help so far! Thanks so much!

  5. #5
    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: Error Handling - make macro more user friendly

    Hi jtn260

    Try this...you might want to consider a User Form...
    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.

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    13,042

    Re: Error Handling - make macro more user friendly

    What's the range of box numbers, i.e., are there any less than 1000 or more than 9999?

  7. #7
    Registered User
    Join Date
    04-05-2014
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Error Handling - make macro more user friendly

    Thanks guys. I'll try your code out jaslake. To protonLeah, the range varies between 1000 - 35000.

  8. #8
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    13,042

    Re: Error Handling - make macro more user friendly

    Please Login or Register  to view this content.

+ 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. user friendly box
    By K-Ching in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-27-2014, 07:34 AM
  2. flookup macro user-friendly
    By wallov in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-30-2013, 05:29 AM
  3. Replies: 3
    Last Post: 01-07-2013, 06:40 PM
  4. User friendly summarising
    By murphybrendan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-12-2010, 06:54 AM
  5. Tracking OT, trying to make it user friendly..
    By impala096 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 05-27-2008, 10:55 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