Results 1 to 9 of 9

Macro code to update Pivot table based on criteria

Threaded View

  1. #1
    Registered User
    Join Date
    08-19-2010
    Location
    Kerala, India
    MS-Off Ver
    Excel 2003
    Posts
    41

    Macro code to update Pivot table based on criteria

    Hi Guys

    The Code given below was give to me by a friend, which helps me to update the pivot tables that I have on a sheet, and also helps me to select the month for which i am checking the report. Now what i have done is i put the data on sheet 2 and sheet 3 and all the pivot tables are on sheet 1. after i have done this change i start getting error from
    " ActiveSheet.PivotTables("PivotTable2").PivotFields("Month").CurrentPage = Range("Month") * 1" the line mentioned above. I think it has something to do with either selecting the month or may due to the movement of the pivot to sheet 1. Can somebody help me on this pleaseeeeeeee


    Option Explicit
    Sub Update()
        ActiveSheet.PivotTables("PivotTable2").RefreshTable
        ActiveSheet.PivotTables("PivotTable4").RefreshTable
        ActiveSheet.PivotTables("PivotTable5").RefreshTable
        ActiveSheet.PivotTables("PivotTable6").RefreshTable
        ActiveSheet.PivotTables("PivotTable2").PivotFields("Month").CurrentPage = Range("Month") * 1
        ActiveSheet.PivotTables("PivotTable4").PivotFields("Month").CurrentPage = Range("Month") * 1
        ActiveSheet.PivotTables("PivotTable5").PivotFields("Month").CurrentPage = Range("Month") * 1
        ActiveSheet.PivotTables("PivotTable6").PivotFields("Month").CurrentPage = Range("Month") * 1
    End Sub
    Last edited by pike; 09-30-2010 at 04:35 AM. Reason: add tags

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