Converting Rows of data into Columns
Solved/Closed
chuaf24
Posts
2
Registration date
Sunday 20 October 2013
Status
Member
Last seen
22 October 2013
-
20 Oct 2013 à 00:57
chuaf24 Posts 2 Registration date Sunday 20 October 2013 Status Member Last seen 22 October 2013 - 22 Oct 2013 à 11:30
chuaf24 Posts 2 Registration date Sunday 20 October 2013 Status Member Last seen 22 October 2013 - 22 Oct 2013 à 11:30
Related:
- How to convert rows into columns in excel
- Rows to columns - Best answers
- Convert rows to columns - Best answers
- Convert number to words in excel - Guide
- How to convert number into words in ms word in shortcut key - Guide
- Excel mod apk for pc - Download - Spreadsheets
- How to change date format in excel - Guide
- How to delete rows and columns in word - Guide
3 responses
TrowaD
Posts
2921
Registration date
Sunday 12 September 2010
Status
Contributor
Last seen
27 December 2022
555
22 Oct 2013 à 11:20
22 Oct 2013 à 11:20
Hi Chuaf,
This is what I did:
1) Paste following sample data on the first sheet which populated range A1:C6 (I added 2 rows with a different Study ID):
2) Added sheet and named it Sheet2.
3) Added header on Sheet2 which took range A1:C1: Study ID - Date1 - Dx1.
4) Run The following code:
5) Completed header on Sheet2 by selecting B1:C1 and dragging it as far as needed to the right.
Best regards,
Trowa
This is what I did:
1) Paste following sample data on the first sheet which populated range A1:C6 (I added 2 rows with a different Study ID):
Study ID Date of DX Dx
3 1-1-2011 123.45
3 2-2-2011 408.19
3 3-2-2011 302.46
4 4-1-2013 199.44
4 5-1-2013 155.76
2) Added sheet and named it Sheet2.
3) Added header on Sheet2 which took range A1:C1: Study ID - Date1 - Dx1.
4) Run The following code:
Sub RunMe()
Dim lRow, lRow2, lCol As Integer
lRow = Range("A1").End(xlDown).Row
Range("A2:C2").Copy Sheets("Sheet2").Range("A2")
For Each cell In Range("A3:A" & lRow)
If cell.Value = cell.Offset(-1, 0) Then
lRow2 = Sheets("Sheet2").Range("A1").End(xlDown).Row
lCol = Sheets("Sheet2").Cells(lRow2, Columns.Count).End(xlToLeft).Column + 1
Range(cell.Offset(0, 1), cell.Offset(0, 2)).Copy _
Sheets("Sheet2").Cells(lRow2, lCol)
Else
lRow2 = Sheets("Sheet2").Range("A1").End(xlDown).Row + 1
Range(cell, cell.Offset(0, 2)).Copy Sheets("Sheet2").Range("A" & lRow2)
End If
Next cell
End Sub
5) Completed header on Sheet2 by selecting B1:C1 and dragging it as far as needed to the right.
Best regards,
Trowa
venkat1926
Posts
1863
Registration date
Sunday 14 June 2009
Status
Contributor
Last seen
7 August 2021
811
20 Oct 2013 à 22:39
20 Oct 2013 à 22:39
not clear what you want.
copy pastespeical transpose ok
copy pastespeical transpose ok
chuaf24
Posts
2
Registration date
Sunday 20 October 2013
Status
Member
Last seen
22 October 2013
22 Oct 2013 à 11:30
22 Oct 2013 à 11:30
Thank you both so much for your responses!!!