+ Reply to Thread
Results 1 to 3 of 3

Separate the data from a table based on certain groups

Hybrid View

acsishere Separate the data from a... 05-12-2009, 04:12 PM
StephenR Re: Separate the data from a... 05-12-2009, 05:11 PM
acsishere Re: Separate the data from a... 05-13-2009, 02:40 PM
  1. #1
    Registered User
    Join Date
    04-15-2008
    Location
    Tamil Nadu, India.
    MS-Off Ver
    Microsoft Office 2016
    Posts
    584

    Thumbs up Separate the data from a table based on certain groups

    Dear Friends,

    I have a worksheet with 10000 records. For example, entire data in ColA-ColZ.

    In that, ColA-ColF - Personal Information; ColG-J Group1; ColK-N Group2; ColO-R Group3; ColS-U Group4; ColW-Z Group5.

    I this case, the data to be copied into another sheet as follows:

    1) the personal data should be copied repeatedly.
    2) Each Group data should be copied next to personal data.
    3) The group's name is mentioned at the top of the datasheet.

    I have attached a sample workbook for your kind reference.

    I hope someone will help me to solve this.

    Thanks a lot in advance,
    acsishere.
    Attached Files Attached Files
    Last edited by acsishere; 05-13-2009 at 02:40 PM.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Separate the data from a table based on certain groups

    This works for your example, but I'm not sure if other things such as the number of categories A/B/C/D varies. This code assumes not.
    Sub x()
    
    Dim c As Long, nLast As Long
    
    Sheets("Datasheet").Activate
    nLast = Cells(Rows.Count, 1).End(xlUp).Row - 2
    c = 7
    With Sheets("Separated")
        .Cells(1, 1).Resize(, 6) = Array("PER1A", "PER1B", "PER1C", "PER1D", "PER1E", "PER1F")
        .Cells(1, 7).Resize(, 4) = Array("A", "B", "C", "D")
        Do While Not IsEmpty(Cells(3, c))
            Cells(3, 1).Resize(nLast, 6).Copy .Cells(Rows.Count, 1).End(xlUp)(2)
            Cells(3, c).Resize(nLast, 4).Copy .Cells(Rows.Count, 7).End(xlUp)(2)
            c = c + 4
        Loop
    End With
    
    End Sub

  3. #3
    Registered User
    Join Date
    04-15-2008
    Location
    Tamil Nadu, India.
    MS-Off Ver
    Microsoft Office 2016
    Posts
    584

    Thumbs up Re: Separate the data from a table based on certain groups

    Respected Sir,

    This is want exactly I need. You have done it.

    Thanks a lot for your code.

    acsishere.

+ 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