+ Reply to Thread
Results 1 to 2 of 2

Dynamically sort a pivot table

  1. #1
    Forum Contributor
    Join Date
    05-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    186

    Dynamically sort a pivot table

    Sorry, this is going to get wordy.

    I am trying to figure out if there is some VBA code to sort Pivot tables based on the selection of a drop down. I basically want to sort the pivot table largest to smallest on the column that corresponds to that month. I.e. a user selects May from the drop down I would like to sort the PT on “Sum of YTD Billings May (USD)” [it will always be “Sum of YTD Billings “&left(month,3)&” (USD)”.

    I would like it to simulate right clicking on $AQ$6 and selecting [sort>sort largest to smallest].

    The absolute reference will not move so Jan-Dec will always be AM6-AX6 if that makes this easier.
    I can conceptually figure out how to get myself to the cell:
    I can just hlookup $AM$3-$AX$6 for “sum of YTD billings “&left(dropdown,3)”&” (USD) then offset 3,0.
    Or start at the anchor of $AM$3 and offset 3,(a lookup value for the month Jan=1, Feb=2, etc…).

    The attached workbook is the general idea. It’s all dummy data but the column names and sheet names are the same. I have working formulas everywhere else, I was just hoping to get able to get the PT’s to sort for me for some dynamic changes made easy

    Any help would be amazing

    VBA to sort PT by columns.xlsx

  2. #2
    Forum Contributor
    Join Date
    05-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    186

    Re: Dynamically sort a pivot table

    Re posted this in the VBA form, seems like a better place: marked as solved. Here's the link http://www.excelforum.com/excel-prog...ml#post4159511

+ 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] Dynamically updating fields in Pivot Table
    By SandPounder1 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-11-2014, 04:00 PM
  2. Pivot Table Off of Dynamically Changing Data
    By dkim.ags in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-09-2013, 06:36 PM
  3. [SOLVED] Dynamically Changing Position of Pivot Based on Size of Another Pivot Table
    By ggilzow in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-26-2013, 02:42 PM
  4. Need pivot table to count unique values dynamically
    By SJMaye in forum Excel General
    Replies: 17
    Last Post: 07-17-2011, 03:05 AM
  5. DYNAMICALLY data source for pivot table
    By Kalyan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-12-2006, 11:10 PM
  6. Dynamically refreshing Pivot Table Range.
    By Rob in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-08-2006, 11:25 AM
  7. how do i link to a pivot table to get data dynamically
    By Michael001 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-23-2006, 06:30 AM
  8. Pivot Table Dynamically Creating on Query
    By Brent in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-07-2005, 12:05 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