• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Transpose data vertically VBA

Afarag

Member
Hello there,

please i need help in transposing data from horizontal order to vertical,

as shown i need to convert this screen

0


to

0


Note: the range of the main data is variable.

Thanks a lot,
 

Attachments

  • Transpose.xlsx
    26.4 KB · Views: 13
Your image are not visible,
This is based on the uploaded wb.

Code:
Sub transpose_data()
Dim rng As Range, i As Integer, r As Integer, ws As Worksheet
Application.ScreenUpdating = False
r = 2
Set ws = Sheets("Transpose")
With Sheets("Data")
    Set rng = .Range("A2:A21")
    For i = 1 To 30
        rng.Copy ws.Cells(r, 1)
        ws.Range("B" & r & ":B" & r + 19).Value = .Cells(1, i + 1).Value
        rng.Offset(, i).Resize(, 1).Copy ws.Cells(r, 3)
    r = r + 20
    Next
End With
ws.[A1:c1] = Array("Login ID", "Date", "Activity")
Application.ScreenUpdating = True
End Sub
 
Back
Top