Convert Rows to Columns - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Convert Rows to Columns

schallaschalla Posts: 2Member

I need to convert this code so that it works for rows 22-78
Currently it works for only one row
Sub RowsToColumn()
Dim RN As Range
Dim RI As Range
Dim r As Long
Dim LR As Long
Application.ScreenUpdating = False
r = 0

LR = Range("A" & Rows.Count).End(xlUp).row
For Each RN In Range("A1:A" & LR)
r = r + 1
For Each RI In Range(RN, Range("XFD" & RN.row).End(xlToLeft))
r = r + 1
Cells(r, 1) = RI
Next RI
Next RN
Columns("A:A").SpecialCells(xlCellTypeBlanks).Delete Shift:=xlUp
End Sub

This code tranposes(converts a row to a column). Suppose A22 has 10 cells. I converts all this into 1column.

Thank u

Sign In or Register to comment.