Hi, I have an issue, I have a table of user names and the pc name/s they own, i need to transpose the names to one line (as in sheet2 below)
I can transpose the data but have 3000 users to copy so it would take too long, do you know if this could be done automacaly in Excel or VBA?
Thanks
john
Sheet1
john PCname1
john PCname2
Paul PCname3
Davis PCname121
Davis Pcname 55
Davis PCname434
Davis PCname2
Davis Pcname 755
Sheet2 transpose.xlsx
John PCname1 PCname2
Paul PCname3
Davis PCname121 Pcname 55 PCname434 PCname2 Pcname 755
Not really good with formula but try this code. I think it might do the trick
Sub Test() Dim LR As Long: LR = Cells(Rows.Count, 1).End(xlUp).Row Dim x As Long, i As Long, j As Long Columns("D:L").Clear Range("A3:A" & LR).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("D3"), Unique:=True Range("D3").Delete For i = 3 To Cells(Rows.Count, 4).End(xlUp).Row x = 0 For j = 3 To LR If Cells(i, 4) = Cells(j, 1) Then Cells(i, 5 + x) = Cells(j, 2) x = x + 1 End If Next j Next i End Sub
To thank someone who has helped you, click on the star icon below their name.
I hate reading
Portfolio
I need a job.I am young and incompetent
or a pivot table will do the trick
regards pike
If the solution helped please donate here to the RSPCA
Sites worth visiting;
J&R Solutions - royUK
AJP Excel Information - Andy Pope
Spreadsheet Toolbox
VBA for smarties - snb
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks