So far I've find the way to do what I need with simple cell command (repeated in each cell accordingly):
=IF(H45=C15,A14,IF(H45=C18,A17,IF(H45=C21,A20,IF(H45=C24,A23,IF(H45=C27,A26,IF(H45=C30,A29,IF(H45=C33,A32,IF(H45=C36,A35,IF(H45=C39,A38,IF(H45=C42, A41))))))))))
But problem with this method that if there same number appeared in different cells (for example C15 and C18) it always pick up first in the order.
I've also tried to add to the code above line:
.Cells(46, i).Value = .Cells(14 + k, "A").Value
Like this:
Sub SortingGuptaV2()
Dim v As Variant
Dim lngRow As Long
Dim i As Integer
Dim j As Integer
Dim k As Integer
With Worksheets("Gupta")
i = 2
For j = 1 To 10
.Cells(45, i).Value = .Cells(15 + k, "C").Value
.Cells(46, i).Value = .Cells(14 + k, "A").Value
i = i + 2
k = k + 3
Next j
lngRow = 45 'sort row 45
v = Intersect(.Range("B:T"), .Rows(lngRow)).Value 'get values from columns B to Z
For j = 2 To 20 Step 2
.Cells(lngRow, j).Value = Application.WorksheetFunction.Small(v, j / 2)
Next j
End With
End Sub
But it's writing numbers in the order (1, 2, 3 and so on) without relation that I need.
Your help will be much appreciated!
Bookmarks