Results 1 to 2 of 2

Problem with Macro to filter pivot based on a cell value

Threaded View

  1. #1
    Registered User
    Join Date
    09-06-2011
    Location
    Switzerland
    MS-Off Ver
    Excel 2007
    Posts
    1

    Problem with Macro to filter pivot based on a cell value

    Hi everyone,

    I m trying to build a macro in order to filter pivots based on a cell value. I have found the following coding on this forum but I don't understand why it triggers an error "1004 - Application-defined or object-defined error".

    The cell value I m using for filter is a date, i.e. "06.09.2011".

    I have noticed that If I do the same exercice but with text instead of date it works perfectly. Should be kind of format problem.

    The code is the following (the underlined code is the one highlighted by the debugger) :

    Sub VALUEFILTER()
    
    Dim PT As PivotTable
    Set PT = Sheets("Sheet2").PivotTables("PivotTable1")
    PT.PivotFields("Value date").CurrentPage = Sheets("Sheet1").Range("H3").Value
    Set PT = Nothing
    Set PT = Sheets("Sheet3").PivotTables("PivotTable1")
    PT.PivotFields("Value date").CurrentPage = Sheets("Sheet1").Range("H3").Value
    Set PT = Nothing
    
    End Sub
    I precise that I m using Excel 2007.

    Thanks in advance,
    Scarface
    Last edited by Scarface; 09-06-2011 at 09:05 AM.

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