Convert subset of columns to rows and replicating the others in Excel

I have columns A to IV where Column A is unique and all the other columns are related to A eg
A = Group X, coliumns B to IV are individual people that belong to Group A. I need to do vairous calculates for each Agent and which groups be belongs to so I think the easiest is to convert them into rows?

Group 1, John, Tom, Harry
Group 2, John, Alan, Bob
so
Group1, John
Group1, Tom
Group1, Harry
Group2, John
Group2, Alan
Group2, Bob
pcombAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Saqib Husain, SyedEngineerCommented:
This macro will transpose the data from sheet1 range A1 onwards to sheet2

Sub colgroups2rows()
    Dim rw As Range
    Dim cel As Range
    For Each rw In Sheet1.Range("A1:A" & Sheet1.Range("A1").End(xlDown).Row)
        For Each cel In Range(rw.Offset(, 1), rw.End(xlToRight))
            Sheet2.Range("A" & Rows.Count).End(xlUp).Offset(1, 1) = cel
            Sheet2.Range("A" & Rows.Count).End(xlUp).Offset(1) = rw
        Next cel
    Next rw
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pcombAuthor Commented:
Saqib I tried the macro (see attached) but it seems to hang and never complete?

thanks
AgentGroups-tst.xlsm
0
Saqib Husain, SyedEngineerCommented:
I found no macro in the attached file.

I attached the macro to your file. It worked just fine.

Here is the file with the macro. Try it.
AgentGroups-tst.xlsm
0
pcombAuthor Commented:
this worked great thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.