+ Reply to Thread
Results 1 to 4 of 4

Pivot Table DataBodyRange for a dynamic range selection in Cell Formula

  1. #1
    Registered User
    Join Date
    08-07-2012
    Location
    Cleveland, OH
    MS-Off Ver
    Excel 2007
    Posts
    15

    Pivot Table DataBodyRange for a dynamic range selection in Cell Formula

    Copy of table is attached.

    To the right of the Pivot Table on the second sheet is 6 cells that summarize payments for the jobs that are completed.
    If a job is unpaid, the cell is left uncolored.
    If a job is paid, it will be colored either Yellow or Green depending on which branch it pertains to.

    I wish to make this procedure more automated by using a dynamic range selection in VBA that way I can call instead of manually highlighting the desired area in the pivot table.
    My current method is shown in the attached spreadsheet. However I am having trouble and I don't know what to do next.

    Please Login or Register  to view this content.
    That way in Cell I3, Sheet 2, from the attached example, I can enter (something similar to)
    Please Login or Register  to view this content.
    So that my range can be automatically found instead of manually dragging a box around what I want. The pivot tables generated from month to month is no always going to be the same size.

    Just to be clear, the range I wish to capture is the following.
    PTDataBodyRange.png
    Excluding the Grand Total Column and Row.

    Any help is much appreciated.
    Please ask questions if I have not explained my idea correctly.

    Thanks,

    SMCC
    Attached Files Attached Files

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,894

    Re: Pivot Table DataBodyRange for a dynamic range selection in Cell Formula

    One way to do it.
    Please Login or Register  to view this content.
    Then your formula in I5 becomes...
    =SumCellsByColor(GetRange("PivotTable1"),H5)

    Alternately you can use following and use cell reference to any cell within PivotTable.
    Please Login or Register  to view this content.
    I5 then becomes...
    =SumCellsByColor(GetPvtRange(A3),H5)
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Registered User
    Join Date
    08-07-2012
    Location
    Cleveland, OH
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Pivot Table DataBodyRange for a dynamic range selection in Cell Formula

    Thanks, CK76!

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,894

    Re: Pivot Table DataBodyRange for a dynamic range selection in Cell Formula

    You are welcome and thanks for the rep

+ 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 formula with dynamic range
    By tpollard1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-09-2016, 04:13 PM
  2. CELL RANGE SELECTION ON EXISTING PIVOT TABLE
    By Dave Peterson in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-06-2005, 02:05 PM
  3. Count nullstrings in pivot table (databodyrange)
    By jonasmj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-27-2005, 10:06 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