+ Reply to Thread
Results 1 to 8 of 8

error handling in macros

  1. #1
    Registered User
    Join Date
    05-15-2013
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007
    Posts
    32

    error handling in macros

    Hi,

    I need my macro to skip the next 3 lines of code in case of an error. Will i have to rewrite the entire code in my error handler or can i just write a simple line of code in my original macro?

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: error handling in macros

    Something like:
    Please Login or Register  to view this content.

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

    Re: error handling in macros

    You can use this line, but beware it masks the error, does not handle the error, it skips the error line.

    Please Login or Register  to view this content.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Can we see your code?

    Also, what error are you trying to deal with?
    If posting code please use code tags, see here.

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: error handling in macros

    Quote Originally Posted by yudlugar View Post
    Something like:
    Please Login or Register  to view this content.
    note that if you use this syntax any error that occurs after continue_here: will not be handled by your code
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  6. #6
    Registered User
    Join Date
    05-15-2013
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: error handling in macros

    The error is no value to filter as the first column filter removes all the options in certain cases. In that case i want my code to skip the copying part and move to the next section of the code which is some 3 lines after where the error occurs.

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Sounds like an error you can deal with without using On Error.

    Can you post the code, or is it secret?

  8. #8
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: error handling in macros

    check the count of visible cells in one column of the data-if it's greater than one, copy the data otherwise don't :-)

+ 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