+ Reply to Thread
Results 1 to 1 of 1

control Excel PIVOT tables contains a cell value with VBA

  1. #1
    Registered User
    Join Date
    03-31-2014
    Location
    Tilburg, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    1

    Lightbulb control Excel PIVOT tables contains a cell value with VBA

    I have created attached pivot table and created below VBA. But this gives me only the a result if the value in H6 is equal to a value in the Pivot. I need the result in the Pivot that contains the value entered in H6, So in my case if I put the word "sales" in H6 it should give me "Sales Flavors" and "Sales Fragrances".



    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Intersect(Target, Range("H6:H7")) Is Nothing Then Exit Sub
    Dim pt As PivotTable
    Dim Field As PivotField
    Dim NewCat As String
    Set pt = Worksheets("Sheet1").PivotTables("PivotTable1")
    Set Field = pt.PivotFields("Business Unit")
    NewCat = Worksheets("Sheet1").Range("H6").Value
    With pt
    Field.ClearAllFilters
    Field.CurrentPage = NewCat
    pt.RefreshTable
    End With

    End Sub
    Attached Files Attached Files

+ 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] Combo Box to control 5 Pivot Tables - Please Help
    By PWinkz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-20-2013, 05:28 AM
  2. Use combo box to control pivot tables
    By delboy2405 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-22-2012, 10:36 AM
  3. ComboBox control of pivot tables issue
    By delboy2405 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-22-2012, 06:52 AM
  4. Multiple pivot tables 1 filter to control all
    By Cjax in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-11-2011, 02:52 PM
  5. Central control for pivot tables
    By dcozzi in forum Excel General
    Replies: 1
    Last Post: 03-17-2006, 05:55 PM

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