+ Reply to Thread
Results 1 to 3 of 3

Pivot Table Refresh Problems

  1. #1
    PFL
    Guest

    Pivot Table Refresh Problems

    Hi All:
    Hoping that someone can help. I am trying to refresh a pivot table
    using the following code which was inserted on the Daily Production
    Output Sheet(both sheets in the same workbook). I am using Excel 2003
    Private Sub Worksheet_Calculate()


    'If data on this worksheet changes, refresh the pivot table
    Sheets("Daily Production
    Output").PivotTables("PivotTable3").RefreshTable


    End Sub


    The Calculation has been set to Automatic.


    However when I try to run the above code I am getting the following
    error" Run Time error 1044, Application defined or Object defined
    error". I think that the code worked a couple days ago.
    PFL


    What can I do to run the code ?
    Thanks in advance


  2. #2
    Dave Peterson
    Guest

    Re: Pivot Table Refresh Problems

    My first guess is that the pivottable isn't named "pivottable3" (anymore).

    If you rightclick on the pivottable and choose "table options" what do you see
    in the "name" box?

    If that's the only PT on that sheet, you could do:

    Worksheets("daily production output").PivotTables(1).RefreshTable

    (and never have to worry about the name again.)



    PFL wrote:
    >
    > Hi All:
    > Hoping that someone can help. I am trying to refresh a pivot table
    > using the following code which was inserted on the Daily Production
    > Output Sheet(both sheets in the same workbook). I am using Excel 2003
    > Private Sub Worksheet_Calculate()
    >
    > 'If data on this worksheet changes, refresh the pivot table
    > Sheets("Daily Production
    > Output").PivotTables("PivotTable3").RefreshTable
    >
    > End Sub
    >
    > The Calculation has been set to Automatic.
    >
    > However when I try to run the above code I am getting the following
    > error" Run Time error 1044, Application defined or Object defined
    > error". I think that the code worked a couple days ago.
    > PFL
    >
    > What can I do to run the code ?
    > Thanks in advance


    --

    Dave Peterson

  3. #3
    Dave Peterson
    Guest

    Re: Pivot Table Refresh Problems

    And if you have multiple pivottables on that sheet, you could do:

    Dim PT As PivotTable
    For Each PT In Worksheets("Daily Production Output").PivotTables
    PT.RefreshTable
    Next PT

    or even get all the PT's in the whole workbook.

    Me.Parent.RefreshAll

    You may want to add

    application.enableevents = false
    'your code here
    application.enableevents = true

    If there's a chance that the calculation event could be called recursively.






    PFL wrote:
    >
    > Hi All:
    > Hoping that someone can help. I am trying to refresh a pivot table
    > using the following code which was inserted on the Daily Production
    > Output Sheet(both sheets in the same workbook). I am using Excel 2003
    > Private Sub Worksheet_Calculate()
    >
    > 'If data on this worksheet changes, refresh the pivot table
    > Sheets("Daily Production
    > Output").PivotTables("PivotTable3").RefreshTable
    >
    > End Sub
    >
    > The Calculation has been set to Automatic.
    >
    > However when I try to run the above code I am getting the following
    > error" Run Time error 1044, Application defined or Object defined
    > error". I think that the code worked a couple days ago.
    > PFL
    >
    > What can I do to run the code ?
    > Thanks in advance


    --

    Dave Peterson

+ 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