+ Reply to Thread
Results 1 to 7 of 7

VBA: Pivot Table cell Row and Column reference

  1. #1
    Forum Contributor GuruWannaB's Avatar
    Join Date
    01-24-2008
    Location
    An hour due East of Cowtown Ohio
    MS-Off Ver
    2010
    Posts
    421

    VBA: Pivot Table cell Row and Column reference

    I believe I am overthinking this.

    I have a pivot table, which by default provides a GRAND TOTAL row. I am trying to create a macro that references a cell in the GRAND TOTAL row and a pivot table column labeled "ACW". What would the cell selection statement look like? The actual cell row changes each time I change my filters....but the row name remains the same which is why I need to reference the name... I believe there is a simple answer - but I am drawing a blank.

    Thanks in advance,
    I help because of the Pavlovian dog that resides in the inner me...so if you are happy with the results, please add to my reputation. It helps keep me motivated!



    Please mark your threads as Solved once it is solved. Check the FAQ's to see how.

  2. #2
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,567

    Re: VBA: Pivot Table cell Row and Column reference

    It would seem as if you could use an Index/Match formula to accomplish this.
    Say that the row labels are in column A starting with row 3 and that there are 200 rows when no filters are applied.
    Also let "ACW" be the column label in column D
    Use the following to find the grand total of the "ACW" column: =INDEX(D3:D200,MATCH("Grand Total",A3:A200,0))
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  3. #3
    Forum Contributor GuruWannaB's Avatar
    Join Date
    01-24-2008
    Location
    An hour due East of Cowtown Ohio
    MS-Off Ver
    2010
    Posts
    421

    Re: VBA: Pivot Table cell Row and Column reference

    Thanks for the formula....however, I am having an issue in using this in a macro....to identify this cell in column D, with Grand Total in Column A, and changing the formatting....to..lets say a black background.

    Thanks in advance,

    GWB

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,567

    Re: VBA: Pivot Table cell Row and Column reference

    I interpreted 'reference' to mean retrieve, as in retrieve the value of the 'ACW' column of the Grand Total row and display it in another cell. I don't have experience with VBA, however I did find this article that may be of some help.
    https://www.clearpeaks.com/grand-tot...-pivot-tables/

  5. #5
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: VBA: Pivot Table cell Row and Column reference

    Is ACW a field name, or an item within a field?
    Rory

  6. #6
    Forum Contributor GuruWannaB's Avatar
    Join Date
    01-24-2008
    Location
    An hour due East of Cowtown Ohio
    MS-Off Ver
    2010
    Posts
    421

    Re: VBA: Pivot Table cell Row and Column reference

    ACW is a field name

  7. #7
    Forum Contributor GuruWannaB's Avatar
    Join Date
    01-24-2008
    Location
    An hour due East of Cowtown Ohio
    MS-Off Ver
    2010
    Posts
    421

    Re: VBA: Pivot Table cell Row and Column reference

    I actually found a work around. Since the ACW column is consistent - I used the following code to select the last cell in the column - which for my spreadsheet, is always the grand total row.

    Please Login or Register  to view this content.

+ 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. VBA Formatting within pivot table VBA to reference a cell
    By jmzis4me in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-16-2016, 04:51 PM
  2. Use Cell Reference for Pivot table Filter
    By Miskondukt in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-05-2016, 11:22 AM
  3. Replies: 1
    Last Post: 08-14-2015, 02:49 AM
  4. Control Pivot table Column labels by cell reference
    By cmb80 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-11-2014, 06:00 AM
  5. Pivot Table and Cell Reference
    By cmrluvitlevit in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-14-2011, 11:56 AM
  6. [SOLVED] Pivot table subtotal reference to specific cell
    By healthier in forum Excel General
    Replies: 1
    Last Post: 09-25-2008, 04:56 AM
  7. VBA to reference first cell in pivot table?
    By XLML in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-11-2005, 11:56 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