+ Reply to Thread
Results 1 to 4 of 4

Automatically create a group

  1. #1
    Registered User
    Join Date
    05-02-2012
    Location
    Swindon, UK
    MS-Off Ver
    Excel 2007
    Posts
    9

    Automatically create a group

    I am looking for a piece of code that will automatically create a group. The code should check column A and if there is no content in column A it should create a group under the last cell with a value in A. I attach an example. Referring to the spreadsheet, I would expect to see a group being formed from row 5 to row 23. Is it possible to automate?
    Attached Files Attached Files

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Automatically create a group

    What do you mean by group? Are you talking about the "Group" option available under Data-> Group? Can you upload a sample output file so we understand what you need?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    05-02-2012
    Location
    Swindon, UK
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Automatically create a group

    Pretty much exactly what you say arlu. At the moment I am doing it by hand - highlighting several rows then hitting group in the data tab. I have a massive amount of sheets to do thie exercise on, there must be an easier way haha. I have attached the same file amended to what I expect to see.
    Attached Files Attached Files

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Automatically create a group

    Try this code on 1 worksheet
    Please Login or Register  to view this content.
    If its working fine, i can help you in making it work for other worksheets too. Also, please put some text in the row after the last row of data so that the macro will group that set of data as well. Once you test it, you will realise that the last set of rows are not being grouped. Once you put some text such as "End" it should work.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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