+ Reply to Thread
Results 1 to 7 of 7

Change Pivot Table Filter Based on Cell Value when Pivot Table is from an external Databas

  1. #1
    Registered User
    Join Date
    07-30-2014
    Location
    Chicago
    MS-Off Ver
    2010
    Posts
    21

    Change Pivot Table Filter Based on Cell Value when Pivot Table is from an external Databas

    I've been trying to link a cell value like a Date to an external database so that I can just pull the data for the specific date I want. I have the date criteria in a filter field. I was able to get the VBA code to work with a pivot table I created with data within the file, but the code does not seem to be talking to the external database pivot table. How can I change my code to make it tell the external database pivot table to change it's filter field based on what I type in a designated cell? Here is the code I have now. Thank you very much for the help!!!


    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Target.Address = Range("H6").Address Then Exit Sub
    Dim PT As PivotTable
    Dim ptItem As PivotItem

    On Error Resume Next

    For Each PT In Worksheets("Sheet1").PivotTables
    With PT.PivotFields("Reporting Date.Fiscal Week")
    If .EnableMultiplePageItems = True Then
    .ClearAllFilters
    End If
    Set ptItem = .PivotItems(Target.Value)
    If Not ptItem Is Nothing Then
    .CurrentPage = Target.Value
    End If
    End With
    Next


    End Sub

  2. #2
    Registered User
    Join Date
    07-30-2014
    Location
    Chicago
    MS-Off Ver
    2010
    Posts
    21

    Re: Change Pivot Table Filter Based on Cell Value when Pivot Table is from an external Dat

    Bump.......

  3. #3
    Registered User
    Join Date
    07-17-2014
    Location
    Turkey
    MS-Off Ver
    2003
    Posts
    85

    Re: Change Pivot Table Filter Based on Cell Value when Pivot Table is from an external Dat

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    07-30-2014
    Location
    Chicago
    MS-Off Ver
    2010
    Posts
    21

    Re: Change Pivot Table Filter Based on Cell Value when Pivot Table is from an external Dat

    Thank you so much!!!! I spent hours trying to figure this out today. I will try it at work tomorrow.

  5. #5
    Registered User
    Join Date
    07-30-2014
    Location
    Chicago
    MS-Off Ver
    2010
    Posts
    21

    Re: Change Pivot Table Filter Based on Cell Value when Pivot Table is from an external Dat

    Aw. I still can't get it to work. In the (rangename) I put ("H6") to specify the cell I want it to take the value I want to put into the Pivot Table filter field. For (PivotTableName) I put ("PivotTable8"). And for (FieldName) I put ("FiscalWeek").

  6. #6
    Registered User
    Join Date
    07-30-2014
    Location
    Chicago
    MS-Off Ver
    2010
    Posts
    21

    Re: Change Pivot Table Filter Based on Cell Value when Pivot Table is from an external Dat

    I am using OLAP pivot table.

  7. #7
    Registered User
    Join Date
    07-30-2014
    Location
    Chicago
    MS-Off Ver
    2010
    Posts
    21

    Re: Change Pivot Table Filter Based on Cell Value when Pivot Table is from an external Dat

    I have been searching for hours online how to convert the code to work with OLAP pivot table and can't find any solution...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Using vba to change pivot table filter based on cell value in another worksheet
    By kidwispa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-05-2013, 11:10 AM
  2. Change pivot table filter with VBA based on cell values
    By ZeDoctor in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-08-2012, 09:03 AM
  3. Pivot table, assigning a cell wo be change the Pivot table filter
    By jwongsf in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-28-2012, 05:00 PM
  4. Change Pivot table Filter Based on Cell Value *Multiple Filter items* Possible?
    By Flydd in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-27-2012, 06:57 AM
  5. Change Pivot Table Filter Based on Cell Value
    By tohotspur in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-15-2010, 02:55 AM

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