+ Reply to Thread
Results 1 to 4 of 4

How to handle error in VBA to keep code going

  1. #1
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    826

    How to handle error in VBA to keep code going

    I have an extensive vba code and in one section I put an autofilter on the data a adjust 2 colums to give data I need to cut out.
    This works fine.

    However nO I put in data for another month and in this month the 2 selections where not present.
    The code got stuck there.

    Please Login or Register  to view this content.
    But I want it to just continiou then with the next stage of the code.
    How could I do that in this case when it gets stuck on an autofilter?
    Thanks.

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,913

    Re: How to handle error in VBA to keep code going

    Add the line "On Error Resume Next" at the start of the code.

  3. #3
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    826

    Re: How to handle error in VBA to keep code going

    Thanks BadlySpelledBuoy,
    but this is not working for me.

    It still will stop on the autofilter for which it cannot find the given selection paramters and freeze....

    Are there maybe other suggestions how this could be adressed?

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to handle error in VBA to keep code going

    If there are no visible cells to copy(cut), the code will error, one way would be

    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. [SOLVED] How to handle error code when wrong password is entered for unprotect worksheet?
    By redsab in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-18-2020, 09:01 AM
  2. 1004 Error due to nasty server - unable to error handle
    By PuppyOnTheRadio in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-08-2013, 06:39 AM
  3. [SOLVED] Error Handle
    By PR in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-10-2005, 06:05 PM
  4. [SOLVED] How to handle error 8007000e Memory Error
    By L. A. M. in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-27-2005, 11:05 PM
  5. Handle Error.
    By Cactus [ÏÉÈËÇò] in forum Excel General
    Replies: 2
    Last Post: 02-16-2005, 06:22 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