+ Reply to Thread
Results 1 to 3 of 3

Auto select pivot when new items are added

  1. #1
    Registered User
    Join Date
    08-25-2012
    Location
    uk
    MS-Off Ver
    Excel 2003
    Posts
    37

    Auto select pivot when new items are added

    Hi All,

    I have uploaded a sample worksheet trying to automatically update a pivot table, is there a way to update a pivot table by automatically selecting new products when the pivot table is updated rather than go into each pivot table each month and manually selecting new products?.

    Thanks for any help in advance.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    03-11-2014
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    379

    Re: Auto select pivot when new items are added

    Hi,

    Try the attached file. The code is the Sheet1.

    Please Login or Register  to view this content.
    Regards,
    AM

  3. #3
    Registered User
    Join Date
    08-25-2012
    Location
    uk
    MS-Off Ver
    Excel 2003
    Posts
    37

    Re: Auto select pivot when new items are added

    Hi,

    Many thanks for your quick response, is there anyway of adding what you have put above into this piece of code, the code below automatically updates the pivot table according to the month, however I would need to incorporate your code into this code in order to both update the month and the products within the pivot table?

    Private Sub Worksheet_Activate()
    Dim ptItem As PivotItem, sCurrent As String

    sCurrent = UCase(Format(Date, "MMM"))

    Application.ScreenUpdating = False

    With ActiveSheet.PivotTables("Hospital").PivotFields("Month")
    .PivotItems(sCurrent).Visible = True

    For Each ptItem In .PivotItems
    If UCase(ptItem) <> sCurrent Then ptItem.Visible = False
    Next ptItem

    Worksheets("Acc-Pro £").PivotTables("Hospital").RefreshTable

    End With

    End Sub



    Many thanks

+ 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. Pivot table not showing the selected items when filter added
    By ShaliniGomes in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 07-23-2014, 01:44 AM
  2. Newbie: Auto Select/un-Select an Range of Slicer Items
    By luckyali in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-23-2014, 09:52 AM
  3. Pivot Table select all Pivot Items not working as intended
    By rasonline in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-13-2014, 05:22 PM
  4. Select all items in pivot table in VBA
    By JohnSeito in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-02-2013, 04:42 AM
  5. Pivot Table-Select Pivot Items
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-28-2011, 01:20 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