Hell every body. I got this code for transpose a column to many rows
I need to make this code work in this way i supposed the number of columns 3 it is possible to be another number :
First Case
original column
1
2
3
4
5
6
7
8
9
transposed range
1 4 7
2 5 8
3 7 9
Second case
original range
1 11 111
2 22 222
3 33 333
4 44 444
5 55 555
transposed range
1 2 3
11 22 33
111 222 333
4 5
44 55
444 555
thanks in advance
Code:
Application.ScreenUpdating = False
On Error Resume Next
Dim i&, z&, x&, y1&
y1 = InputBox("Choose the number of columns")
y2 = InputBox("Choose the number of rows")
i = Cells(Rows.Count, 1).End(xlUp).Row
z = 2: x = 2
Range("B2:K" & i) = ""
While z <= i
Range("b" & x).Resize(, y1) = _
WorksheetFunction.Transpose(Range("a" & z).Resize(y1))
z = z + y1: x = x + 1
Wend
Application.ScreenUpdating = True
I need to make this code work in this way i supposed the number of columns 3 it is possible to be another number :
First Case
original column
1
2
3
4
5
6
7
8
9
transposed range
1 4 7
2 5 8
3 7 9
Second case
original range
1 11 111
2 22 222
3 33 333
4 44 444
5 55 555
transposed range
1 2 3
11 22 33
111 222 333
4 5
44 55
444 555
thanks in advance