+ Reply to Thread
Results 1 to 15 of 15

Ignore Error in VBA

  1. #1
    Forum Contributor
    Join Date
    06-15-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    100

    Ignore Error in VBA

    Hi peeps,

    I've currently got a VBA macro that currently filters 4 pivot tables based off a cell value. The problem is, occasionally, the text typed into the cell (K2) won't be an option within the pivot table filter. I want the macro to then bypass this pivot and not touch this filter.

    I've tried using On error Resume Next but to no avail.

    Any helps appreciated.

    Cheers,


    Please Login or Register  to view this content.

  2. #2
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Ignore Error in VBA

    You may try:
    Please Login or Register  to view this content.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  3. #3
    Forum Contributor
    Join Date
    06-15-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    100

    Re: Ignore Error in VBA

    Works an absolute treat, thanks so much Izandol.

    Can I be cheeky and ask if it's possible to also add a textbox pop up in, giving a warning to the user that the pivot hasn't been updated?

  4. #4
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Ignore Error in VBA

    Of course - it is only small change:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    06-15-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    100

    Re: Ignore Error in VBA

    You're a god among men. Thanks so much.

  6. #6
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Ignore Error in VBA

    You are welcome. Please remember to mark this question solved.

  7. #7
    Forum Contributor
    Join Date
    06-15-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    100

    Re: Ignore Error in VBA

    Sorry to bring this thread back up but I'm now receiving a run time error with the line ".CurrentPage = vValue" highlighted on the second part of the code.

    I can't for the life of me figure out why it's that highlighted.

    Any helps appreciated.

  8. #8
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Ignore Error in VBA

    What is vValue data type? Is it date?

  9. #9
    Forum Contributor
    Join Date
    06-15-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    100

    Re: Ignore Error in VBA

    I have no idea which data the VValue is Is that the field we are amending in the pivot table? If so, it's text..

  10. #10
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Ignore Error in VBA

    Please change FilterField routine:
    Please Login or Register  to view this content.
    and run code again and report value given in error message.

  11. #11
    Forum Contributor
    Join Date
    06-15-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    100

    Re: Ignore Error in VBA

    Thanks very much for your help on this btw.

    Just run it and got the error "Error occurred setting filter to value:Roncalli" (Roncalli is the name of a salesperson in cell K2)

  12. #12
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Ignore Error in VBA

    Is there data for this salesperson in all pivot tables?

  13. #13
    Forum Contributor
    Join Date
    06-15-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    100

    Re: Ignore Error in VBA

    Nope, that's what I'm guessing is the problem.

    But I thought you had set this up so it would bypass the pivot tables where he has no data

  14. #14
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Ignore Error in VBA

    If data does not exist now, but did before, it may be retained in pivot item list. In pivot table options, you may set retained item limit to none and test again. If this does not resolve problem, please post sample workbook?

  15. #15
    Forum Contributor
    Join Date
    06-15-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    100

    Re: Ignore Error in VBA

    Is there anything you can't do Izandol? You're a genius.

    A million thank you's

+ 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. Average ignore #DIV/0! error
    By blackstar in forum Excel General
    Replies: 6
    Last Post: 10-17-2016, 05:24 PM
  2. Ignore #N/A Error In SUMPRODUCT
    By katsuya in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-14-2013, 09:14 AM
  3. Ignore error (#value)
    By Jaspal in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-08-2013, 10:40 AM
  4. Ignore Error '1004' help
    By skito1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-26-2006, 01:40 AM
  5. Ignore Error in Formula?
    By theillknight in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-09-2005, 11:03 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