Error 50290 after updating pivotable

  • I'm using worksheet_PivotTableUpdate(ByVal Target As PivotTable) to run some code, but I'm getting a 50920 error. This happens regardless of the what the code it. I think it's due to the pivottable not refreshing before running the code.


    Anyone know what might be causing this, and the solution?

  • Re: Error 50290 after updating pivotable


    So you get the error even if the code in the event is just a simple MsgBox line?

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • Re: Error 50290 after updating pivotable


    Actually, I just tested it with only a msgbox, and it works ok. However, I note the msgbox appears before the pivottables and pivotcharts finish refreshing. This confirms that the code starts running before the pivot tables are finished updating.


    BTW, the usual first line of code that fails is Application.ScreenUpdating = False (or if I remove that, a series of if statements).


    I think an obvious (but perhaps not the best) solution is to ensure the pivots have finished updating before the code kicks in. Also, I should have mentioned that there are multiple pivot tables being refreshed via slicers, hence why they take so long.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!