Results 1 to 7 of 7

Thread: [RESOLVED] Change Pivot Table & Pivot Chart through VBA

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2013
    Posts
    81

    Resolved [RESOLVED] Change Pivot Table & Pivot Chart through VBA

    Dear All,

    I have attached a sample file for your reference. In that file, I have three worksheets 1) Data 2) Chart and 3) Pivot.

    I have written a small code in "Chart" worksheet to change the Pivot chart based on selection made in the cell "F6".

    Code:
    Private Sub Worksheet_Change(ByVal Target As Range)
     
     If Not Application.Intersect(Target, Sheets("Chart").Range("F6")) Is Nothing Then
    Sheets("Pivot").PivotTables("PivotTable1").PivotFields("Name"). _
        ClearAllFilters
    Sheets("Pivot").PivotTables("PivotTable1").PivotFields("Name").CurrentPage _
        = Sheets("Chart").Range("F6").Value
     
     End If
     
     End Sub
    Now Pivot Chart also shows for all months from January to December. But I want to restrict the Pivot Chart even for months. So if I select January, then Pivot Chart should show only January month data and If I select Jan, Feb, Mar, then Pivot Chart should show only Jan, Feb and Mar months data instead of all months.

    Current Challenges:
    1) I am not able to select multiple months at a time in cell M6, since I have used data validation. Is it possible to use some other option which will help us to select multiple items from the dropdown list?
    2) Is it possible to write a VBA code to change the Pivot Chart based on the selection made in Cell M6 along with F6?

    Can someone please help me to overcome the above mentioned challenges and achieve required results?

    Best Regards
    Amrutha
    Attached Files Attached Files

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Nov 2013
    Posts
    81

    Re: Change Pivot Table & Pivot Chart through VBA

    Can someone please help me on this?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2013
    Posts
    81

    Re: Change Pivot Table & Pivot Chart through VBA

    Hi Pete,

    Could you please help me on this? please...

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Nov 2013
    Posts
    81

    Re: Change Pivot Table & Pivot Chart through VBA

    Dear All,

    Can someone please help me?????

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Nov 2013
    Posts
    81

    Re: Change Pivot Table & Pivot Chart through VBA

    Did any one get a chance to look at this? Please help me...

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Nov 2013
    Posts
    81

    Re: Change Pivot Table & Pivot Chart through VBA

    Hi vbfbryce,

    I hope you can help me on this please?

    Best Regards
    Ammu

  7. #7
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: Change Pivot Table & Pivot Chart through VBA

    I've never once used a pivot table, so I can't be of any help on that part.

    For the multiple selection part, maybe look at this:

    http://blog.contextures.com/archives...lidation-list/

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width