Hi,
I have a macro which creates rows according to a column value cell and transposes the rest of columns; and this works fine.
Sub Copydata1()
Dim data1 As Variant, data2 As Variant
Dim i As Long
With Range("A4", Cells(Rows.Count, "A").End(xlUp))
data1 = .Resize(, 21).Value
data2 = .Offset(, 21).Resize(, 33).Value
.Resize(, 33).ClearContents
End With
For i = LBound(data1) To UBound(data1)
With Cells(Rows.Count, 1).End(xlUp).Offset(1)
.Resize(data1(i, 21), 21) = Application.Index(data1, i, 0)
.Offset(, 21).Resize(data1(i, 21), 1) = Application.Transpose(Application.Index(data2, i, 0))
End With
Next
End Sub
The problem is that I have several other columns which I would like to transpose (column position 35 -46) and clear its contents, just as the above but I am having some problems to do this.
Kind Regards
Dan
I have a macro which creates rows according to a column value cell and transposes the rest of columns; and this works fine.
Sub Copydata1()
Dim data1 As Variant, data2 As Variant
Dim i As Long
With Range("A4", Cells(Rows.Count, "A").End(xlUp))
data1 = .Resize(, 21).Value
data2 = .Offset(, 21).Resize(, 33).Value
.Resize(, 33).ClearContents
End With
For i = LBound(data1) To UBound(data1)
With Cells(Rows.Count, 1).End(xlUp).Offset(1)
.Resize(data1(i, 21), 21) = Application.Index(data1, i, 0)
.Offset(, 21).Resize(data1(i, 21), 1) = Application.Transpose(Application.Index(data2, i, 0))
End With
Next
End Sub
The problem is that I have several other columns which I would like to transpose (column position 35 -46) and clear its contents, just as the above but I am having some problems to do this.
Kind Regards
Dan