Consulting

Results 1 to 2 of 2

Thread: Need to transpose data from rows to columns

  1. #1
    VBAX Regular
    Joined
    Jun 2007
    Location
    Texas
    Posts
    62
    Location

    Need to transpose data from rows to columns

    I currently have a file with multiple rows of data per person. Column D has a unique ID # for each person. I need each row of in column H converted to columns beginning in column N creating a new row whenever the ID # changes. The information below are other columns which data remains the same for each ID #.

    Column A - Last Name
    Column B - First Name
    Column C - Grade
    Column D - ID
    Column E - Home School
    Column F - Year
    Column G - Math
    Column H - Accom Number

    Thank you in advance for your assistance.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Public Sub MergeRows()
    Dim lastrow As Long
    Dim i As Long
    
        Application.ScreenUpdating = False
        
        With ActiveSheet
        
            lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
            For i = lastrow To 2 Step -1
            
                If .Cells(i, "D").Value = .Cells(i - 1, "D").Value Then
                
                    .Cells(i, "N").Resize(, 100).Copy .Cells(i - 1, "O")
                    .Cells(i - 1, "N").Value = .Cells(i, "H").Value
                    .Rows(i).Delete
                End If
            Next i
        End With
        
        Application.ScreenUpdating = True
    End Sub
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •