+ Reply to Thread
Results 1 to 3 of 3

Thread: Transpose cant work

  1. #1
    Registered User
    Join Date
    11-01-2011
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    8

    Transpose cant work

    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

  2. #2
    Valued Forum Contributor
    Join Date
    12-14-2009
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    986

    Re: Transpose cant work

    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

  3. #3
    Forum Guru pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2010
    Posts
    5,150

    Re: Transpose cant work

    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

+ 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.2.0