Public Sub MrE_1228923_1702D0E_Update()
' https://www.mrexcel.com/board/threads/copying-top-5-rows-after-applying-filters.1228923/
Dim ws1 As Worksheet
Dim LRow As Long
Dim rngCopy As Range
Dim rngVisColA As Range
Dim rngCell As Range
Dim rngArea As Range
Dim lngCounter As Long
Dim blnEnd As Boolean
Const clngMax As Long = 5
Set ws1 = Worksheets(3) 'Third worksheet in workbook, I'd preferred to use
'either the sheetname or the codename instead of Index here
LRow = ws1.Cells(Rows.Count, 1).End(xlUp).Row
With ws1.Range("A1").CurrentRegion
.AutoFilter 2, Criteria1:=">=2", Operator:=xlAnd
With ws1.AutoFilter.Sort
.SortFields.Clear
.SortFields.Add2 Key:=ws1.Range("N1", ws1.Range("N" & ws1.Rows.Count).End(xlUp)), _
SortOn:=xlSortOnValues, _
Order:=xlDescending, _
DataOption:=xlSortNormal
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
If WorksheetFunction.CountA(.Columns(1)) > 0 Then
Set rngVisColA = .Range("A1:A" & LRow).SpecialCells(xlCellTypeVisible)
For Each rngArea In rngVisColA.Areas
If blnEnd Then Exit For
For Each rngCell In rngArea.Cells
If blnEnd Then Exit For
lngCounter = lngCounter + 1
If rngCell.Row > 1 Then
If rngCopy Is Nothing Then
Set rngCopy = Union(rngCell, rngCell.Offset(0, 13))
Else
Set rngCopy = Union(rngCopy, rngCell, rngCell.Offset(0, 13))
End If
End If
If lngCounter = clngMax + 1 Then blnEnd = True
Next rngCell
Next rngArea
rngCopy.Copy .Range("T3")
End If
.AutoFilter
End With
Set rngCopy = Nothing
Set rngVisColA = Nothing
End Sub