+ Reply to Thread
Results 1 to 4 of 4

Proper Error Handling Routine

  1. #1
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Proper Error Handling Routine

    Hi all,

    I'm trying to get more familiar with Error Handling in VBA. I am using below code and need to set the value of my variables x and y to 0 every time an error occurs. What is the best way of doing that?

    Basically, if it cannot find the TextBox in my UserForm or if there's a divison error, it should set the variable y or x to 0, if there's no error, it should calculate/lookup the actual value and then resume to the last bit of my module where x and y are compared and the TextBox coloured accordingly.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,267

    Re: Proper Error Handling Routine

    I don't know if this below is "proper", but try this concept:
    Please Login or Register  to view this content.
    Last edited by mjr veverka; 11-30-2018 at 06:26 AM. Reason: without colon after "Else" in "Else: is_arr = False: indx = 1"

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,960

    Re: Proper Error Handling Routine

    Please Login or Register  to view this content.
    Ben Van Johnson

  4. #4
    Forum Contributor
    Join Date
    07-13-2017
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    481

    Re: Proper Error Handling Routine

    Thanks both!! will incorporate that into my code! Things seem to work so far.

+ 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. Stop routine with error handling
    By Jan Wieland in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-08-2016, 06:50 AM
  2. barcodes handling as daily routine
    By jacohauritz in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 08-09-2016, 12:43 PM
  3. Proper application not handling apostrophes
    By nickmax1 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-29-2015, 09:57 AM
  4. Error handling inside error handling
    By grantastley in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-06-2015, 03:43 AM
  5. [SOLVED] Error checking routine - check range values on various worksheets and report if error
    By TheRobsterUK in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-29-2014, 06:36 AM
  6. Error Handling - On Error GoTo doesn't trap error successfully
    By David in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-16-2006, 02:10 PM
  7. Error handling with a handling routine
    By ben in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-15-2005, 11:06 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