+ Reply to Thread
Results 1 to 2 of 2

Code to Refresh Pivot Table

  1. #1
    S Jackson
    Guest

    Code to Refresh Pivot Table

    I have a workbook with multiple worksheets. Each worksheet has its own
    pivot table.

    I put this code on the first worksheet with a pivot table and it works
    great:
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    ActiveSheet.PivotTables(1).PivotCache.Refresh
    End Sub
    But, when I copy this code to the second worksheet, I get this error:
    "Pivot table is not valid."

    What's up?
    S. Jackson



  2. #2
    S Jackson
    Guest

    Re: Code to Refresh Pivot Table

    Okay, I somehow fixed my problem by simply deleting the pivot table on the
    second worksheet and then re-inserting it. Everything works fine now. Go
    figure?

    S. Jackson

    "S Jackson" <jackson_shelly@hotmail.com> wrote in message
    news:O#KOKokrFHA.1172@TK2MSFTNGP11.phx.gbl...
    > I have a workbook with multiple worksheets. Each worksheet has its own
    > pivot table.
    >
    > I put this code on the first worksheet with a pivot table and it works
    > great:
    > Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    > ActiveSheet.PivotTables(1).PivotCache.Refresh
    > End Sub
    > But, when I copy this code to the second worksheet, I get this error:
    > "Pivot table is not valid."
    >
    > What's up?
    > S. Jackson
    >
    >




+ 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