+ Reply to Thread
Results 1 to 3 of 3

Error Handling and linking VBA to specific workbook

  1. #1
    Valued Forum Contributor Miraun's Avatar
    Join Date
    04-03-2009
    Location
    New England
    MS-Off Ver
    2003, 2007, 2010, 2013
    Posts
    554

    Error Handling and linking VBA to specific workbook

    Hello everyone. Thank you again for all of your help on my previous thread:
    http://www.excelforum.com/excel-prog...on-update.html

    Here is the followup / Next steps that I will be working on.

    Here was the code I am currently working with:
    Please Login or Register  to view this content.
    My questions are two fold, as mentioned in the title:

    Foremost, it was recommended on the other thread that I should include an error handling routine while I work on the code for instances where things simply don't work as intended. I have created a separate sub with Application.enableEvents = True, but was the error handling routine that was recommended I place into the sheet more automated than running a separate macro?

    Secondly, this VBA works well, however, I'm having problems if I have two worksheets open. Is there a way to bind this VBA to the single workbook, rather than all excel workbooks open in the Excel instance?

    And again, thank you everyone for your help on this project of mine. I'm sure there will be many more questions to follow as I continue to work on this.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Error Handling and linking VBA to specific workbook

    Turning events off and on is completely orthogonal to the need for error handling.

    Whether you need an error handler depends on why your code throws errors. Why would yours, and what do you want the behavior to be when that happens?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,378

    Re: Error Handling and linking VBA to specific workbook

    IMO, if you turn events off in a procedure, you should always have an error handler and a single exit point to ensure that events are turned back on.
    That VBA is bound to the worksheet and will only fire when that worksheet calculates.
    Everyone who confuses correlation and causation ends up dead.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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