Results 1 to 3 of 3

Thread: vba program to actualice pivotTable

  1. #1

    vba program to actualice pivotTable



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hi,

    I want to actualice all PT with an Makro. All PT are indipendent from each other and is also on different worksheets. Following programm do I have but it isn't working and I don't know why:

    Code:
    Dim pvt As PivotTable, j As Integer
    For j = 1 To ActiveSheet.PivotTables.Count
    Set pvt = ActiveSheet.PivotTables(j)
    ActiveSheet.PivotTables(j).PivotCache.Refresh
    Next
    Another sugestion was to activate the different worksheets but it is also not working:

    Code:
    Dim wks As Worksheet, pvt As PivotTable, i As Integer, j As Integer
    For i = 1 To ActiveWorkbook.Worksheets.Count
    Set wks = ActiveWorkbook.Worksheets(i)
    For j = 1 To ActiveSheet.PivotTables.Count
    'Set pvt = ActiveSheet.PivotTables(j)
    ActiveSheet.PivotTables(j).PivotCache.Refresh
    Next
    Next

    Thank you for your help.
    Last edited by Bob Phillips; 2011-10-12 at 09:57 AM. Reason: Added code tags

  2. #2
    Why not just try

    ActiveWorkbook.RefreshAll

  3. #3
    Thank you very much. This was a really easy solution. Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •