Sub NewList_v2()
Dim i As Long, j As Long, k As Long, Cols As Long, LastRow As Long, rws As Long
Dim a As Variant, b As Variant, aRws As Variant, aCols As Variant
'First actual data row in 'SL'
Const FirstRow As Long = 10
'Columns of Interest in 'SL', in the order we want
'That is AB AA X A B C D BM
Const ColsOfInterest As String = "28 27 24 1 2 3 4 65"
'Value you want to filter on
Const FilterVal As Long = 10
'Make an array of column numbers for data area
aCols = Split(ColsOfInterest)
'Number of columns in result
Cols = UBound(aCols)
With Sheets("SheetSL")
'Find last row in Index column
LastRow = .Cells(.Rows.Count, CLng(aCols(Cols))).End(xlUp).Row
'Make an array of row numbers for data area. ie 10, 11, 12, ..
aRws = Evaluate("row(" & FirstRow & ":" & LastRow & ")")
'Read all data rows, but only the cols of interest into an array
a = Application.Index(.Columns("A:BM"), aRws, aCols)
End With
'Calculate number of data rows
rws = LastRow - FirstRow + 1
'Set up b as an array to receive results
ReDim b(1 To rws, 1 To Cols)
'Loop through rows and put ones that have correct Index value into array b
For i = 1 To rws
If a(i, 8) = FilterVal Then
k = k + 1
For j = 1 To Cols
b(k, j) = a(i, j)
Next j
End If
Next i
'Put results into 'FF' sheet and sort
With Sheets("SheetFF").Range("G4").Resize(k, Cols)
.Value = b
.Sort Key1:=.Cells(1, 1), Order1:=xlAscending, Header:=xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
End With
End Sub