+ Reply to Thread
Results 1 to 1 of 1

VBA for Grouping Cells that are copied from a Pivot Table

  1. #1
    Registered User
    Join Date
    03-28-2010
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    60

    VBA for Grouping Cells that are copied from a Pivot Table

    Hello,

    I have a situation where I need to group rows of a table that has been copied from a Pivot Table. There are so many rows that doing this manually takes considerable time so any help that can be provided is much appreciated.

    The table is structured much like a Pivot Table in that it has subtotals at each section of the hierarchy. The attached file demonstrates the basic structure of what I am dealing with. In column A, I have the first column of the hierarchy which is subtotaled. Column B is the second column of the hierarchy and column C would be the values. For all the categories in the hierarchy, there will be a variable number of categories (ie in the file I have only one Primary Value listed under Primary Value, but I could have many more). Same applies to the Secondary Value of the hierarchy.

    I was thinking that after I get the counts of the number of unique values in the Primary Value and Secondary Value, I could set a do until = Primary Value Count/Secondary Value Count loop to set the groupings, but I am failing to understand how to code the groupings so the sub would know that A2:A12 (for example in the attached workbook) is a grouping. Further, I dont understand how once that first grouping is made, to tell the macro to step down to A13:Ax to make the next grouping and so on.

    Thank you again for any guidance.

    learning_vba
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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