Hi there
I am trying to develop a code that select two cells (one name + one number) in one sheet (SMI_Ranking) and transpose them in a new sheet (Final_ranking). The cells I want to copy are every 4th column
From
name1/nb1...[4columns]...name2/nb2 ....[4columns].... name3/nb3
to
name1/nb1
name2/nb2
name3/nb3
Below is the code I tried to do but it is not working.
Has anyone an idea ?
Thanks!
I am trying to develop a code that select two cells (one name + one number) in one sheet (SMI_Ranking) and transpose them in a new sheet (Final_ranking). The cells I want to copy are every 4th column
From
name1/nb1...[4columns]...name2/nb2 ....[4columns].... name3/nb3
to
name1/nb1
name2/nb2
name3/nb3
Below is the code I tried to do but it is not working.
Has anyone an idea ?
Thanks!
Code:
Sub Finalranking()
Dim a, j As Integer
Dim table As Variant
'select the 2 cells every two 4 columns
For j = 5 To 121 Step 4
table(1, j) = Worksheets("SMI_Ranking").Range(Cells(1, j - 1), Cells(1, j))
'put the result in the "ranking" sheet
Worksheets.Add().Name = "Final_ranking"
Worksheets("Final_ranking").Activate
a = 1
Cells(1, a).Value = table(1, j)
a = a + 1
Next j
End Sub