+ Reply to Thread
Results 1 to 7 of 7

Help with Macro, need it to skip a step if that step isn't needed

  1. #1
    Registered User
    Join Date
    03-06-2012
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2010
    Posts
    48

    Help with Macro, need it to skip a step if that step isn't needed

    So the macro is designed to filter a list based on what the user enters, as part of this macro it also resets the sheet to show all data so multiple filters don't mess each other up. essentially I'd like it to skip the "showalldata" portion if the sheet contains no filters. as it currently returns an error, and id rather set it up to skip it if possible then attach another macro and instructing the user to use it if the first macro produces the error. Thoughts???? thanks in advance for any help.

    the macro is as follows: the and section causing the error bolded;

    Please Login or Register  to view this content.
    Last edited by CDNcameron; 03-23-2012 at 02:28 PM. Reason: Added CODE tags for user, please do so yourself in the future.

  2. #2
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Help with Macro, need it to skip a step if that step isn't needed

    try replacing that line with

    Please Login or Register  to view this content.
    If you liked my solution, please click on the Star -- to add to my reputation

    If your issue as been resolved, please clearly state so and mark the thread as [SOLVED] using the thread tools just above the first post.

  3. #3
    Registered User
    Join Date
    03-06-2012
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2010
    Posts
    48

    Re: Help with Macro, need it to skip a step if that step isn't needed

    That works in the case of uses when the filters don't need to be reset. But in the cases where it needs to reset the data it doesn't reset it before applying the new filters, which is why the line to showalldata was added.

    Thanks for the help though,

    James

  4. #4
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Help with Macro, need it to skip a step if that step isn't needed

    you could just put in an error catch that would skip the line if it caused an error

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-06-2012
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2010
    Posts
    48

    Re: Help with Macro, need it to skip a step if that step isn't needed

    Worked like a charm, Thanks very much, adding to my list of cool macro commands.

    Thanks Again,
    James H. Cameron

  6. #6
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Help with Macro, need it to skip a step if that step isn't needed

    no problem, glad i could help.

  7. #7
    Forum Contributor
    Join Date
    02-07-2012
    Location
    MIA
    MS-Off Ver
    Excel 2007, 2010
    Posts
    429

    Re: Help with Macro, need it to skip a step if that step isn't needed

    Personally, I wouldn't use On Error Resume next, because if you have another part of your code which may need error checking, the On Error GoTo 0 statement wouldn't allow you to do it. Instead I'd do the following:

    Please Login or Register  to view this content.
    Last edited by Pichingualas; 03-23-2012 at 02:36 PM.
    .?*??)
    `?.???.?*??)?.?*?)
    (?.?? (?.?
    Pichingualas <---
    ??????????????????????????

    Wrap your code with CODE TAGS.
    Thank those who helped you, Don't forget to add to their REPUTATION!!! (click on the star below their post).
    Please mark your threads as [SOLVED] when they are (Thread Tools->Mark thread as Solved).

+ 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