+ Reply to Thread
Results 1 to 5 of 5

Group an unknown number of rows which start with a given string of text

  1. #1
    Registered User
    Join Date
    11-25-2016
    Location
    Portugal
    MS-Off Ver
    Office 365
    Posts
    15

    Group an unknown number of rows which start with a given string of text

    Hi there!

    I hope someone can help me. In order for it to be easier to explain, I attach a file that is from my current work in which I need your help. In the attached file, there is a sheet called "Origin" that is how I have the file. And then there is a sheet called "Result" that is what I need to achieve.

    Now my explanation:

    On column "H" there are a huge ammount of cells which contain some codes of mine: "CAP"; "T"; "P" and finally "OC". These create a tree of sorts, something like this:

    T
    *P
    **OC
    **OC
    **OC

    *P
    **OC
    **OC

    *P
    **OC
    **OC
    **OC
    **OC

    The number of "OC" varies greatly depending of each "P".

    I need a macro that will GROUP (NOT HIDE) every "OC", under it's "P", something like "Selection.Rows.Group"

    I have another macro on my sheet that I use to give me the sum of each "CAP" and I know it can be used for what I need now, but I just don't have the vba knowledge to adapt it to my new need. Maybe it could be the base for my help. It goes like this:

    Please Login or Register  to view this content.
    Thank you for your time.


    *EDIT: placed the code tags
    Attached Files Attached Files
    Last edited by rcosteira; 04-16-2019 at 05:16 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,367

    Re: [HELP] Group an unknown number of rows which start with a given string of text

    Administrative Note:

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    11-25-2016
    Location
    Portugal
    MS-Off Ver
    Office 365
    Posts
    15

    Re: [HELP] Group an unknown number of rows which start with a given string of text

    Sorry MOD, I corrected it.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,367

    Re: Group an unknown number of rows which start with a given string of text

    Thank you.

  5. #5
    Registered User
    Join Date
    11-25-2016
    Location
    Portugal
    MS-Off Ver
    Office 365
    Posts
    15

    Re: Group an unknown number of rows which start with a given string of text

    Hi again,

    Can anyone shed some light on this one?

    Thank you for your time

+ 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] SUM for unknown number of set of rows
    By California4jx in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 12-27-2016, 05:15 PM
  2. [SOLVED] Searching for unknown text string in a range and then matching it to a reference table
    By the_nibs in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 06-10-2015, 07:26 AM
  3. Replies: 2
    Last Post: 07-31-2013, 05:57 PM
  4. Loop to Sum Unknown Number of Rows
    By DBExhale in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-15-2010, 07:19 AM
  5. Sum of Unknown Number of Rows
    By Colin_S in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-12-2010, 11:27 AM
  6. Replies: 4
    Last Post: 08-02-2010, 04:26 PM
  7. sum up an unknown number of rows
    By skoller in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-12-2006, 07:33 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