J
jer
Some assistance please. I am working with a spreadsheet that was created
outside of excel and I am trying to create a simple spreadsheet within the
workbook on a different sheet. The first 4 rows are header and the next 4
rows are details for the respective headers
Header 1a header 1b header 1c ...
Header 2a header 2b header 2c ...
Header 3a header 3b header 3c ...
Header 4a header 4b header 4c ...
Details 1a Details 1b Header 1c
Details 2a Details 2b Header 2c
Details 3a Details 3b Header 3c
Details 4a Details 4b Header 4c
....
I am trying to convert to excel "standard" worksheet
Header 1a Header2a header3a header4a header1b ....
details 1a details2a details3a details4a details1b ...
there are 9 columns in the report. I am seriously having problems with this
I can loop through the columns but I am not sure how to go to the next row
when all the details for 1 record is transposed to the new worksheet. See my
attempt below
Sub check()
Dim larow As Long, k As Long
larow = Cells(Rows.Count, 1).End(xlUp).Row
For k = larow To 1 Step -1
If IsNumeric(Right(Cells(k, 1), 10)) Then
Dim cell As Range, cell1 As Range
Set cell = Cells(k, 1)
Set cell1 = ActiveWorkbook.Sheets("Sheet2").Cells(2, 1)
Do Until IsEmpty(cell.Value) '?? should this be for ... next??
Range(cell, cell.Offset(4, 0)).Copy
cell1.Select
Selection.PasteSpecial Paste:=xlPasteAll, Transpose:=True
Application.CutCopyMode = False
Set cell = cell.Offset(0, 1) 'traspose next block
Set cell1 = cell1.Offset(0, 5) 'how do I go to next row
after 'transposing first record??
Loop
End If
Next
End Sub
outside of excel and I am trying to create a simple spreadsheet within the
workbook on a different sheet. The first 4 rows are header and the next 4
rows are details for the respective headers
Header 1a header 1b header 1c ...
Header 2a header 2b header 2c ...
Header 3a header 3b header 3c ...
Header 4a header 4b header 4c ...
Details 1a Details 1b Header 1c
Details 2a Details 2b Header 2c
Details 3a Details 3b Header 3c
Details 4a Details 4b Header 4c
....
I am trying to convert to excel "standard" worksheet
Header 1a Header2a header3a header4a header1b ....
details 1a details2a details3a details4a details1b ...
there are 9 columns in the report. I am seriously having problems with this
I can loop through the columns but I am not sure how to go to the next row
when all the details for 1 record is transposed to the new worksheet. See my
attempt below
Sub check()
Dim larow As Long, k As Long
larow = Cells(Rows.Count, 1).End(xlUp).Row
For k = larow To 1 Step -1
If IsNumeric(Right(Cells(k, 1), 10)) Then
Dim cell As Range, cell1 As Range
Set cell = Cells(k, 1)
Set cell1 = ActiveWorkbook.Sheets("Sheet2").Cells(2, 1)
Do Until IsEmpty(cell.Value) '?? should this be for ... next??
Range(cell, cell.Offset(4, 0)).Copy
cell1.Select
Selection.PasteSpecial Paste:=xlPasteAll, Transpose:=True
Application.CutCopyMode = False
Set cell = cell.Offset(0, 1) 'traspose next block
Set cell1 = cell1.Offset(0, 5) 'how do I go to next row
after 'transposing first record??
Loop
End If
Next
End Sub