我希望代码在数据数量小于20后将剩余数据传输到工作表5并退出循环。
Dim mycell As Range
Dim myrange As Range
Dim lastrow As Long
Set myrange = Worksheets("sheet3").Range("a2:a1000")
myrange.Interior.Pattern = xlnon
For Each mycell In myrange
For i = 1 To 20
If mycell.Value = Application.WorksheetFunction.Small(myrange, i) Then
mycell.Interior.ColorIndex = 4
mycell.Resize(1, 16).Cut Destination:= _
Worksheets("sheet5").Range("a1").Offset(Worksheets("sheet5").Rows.Count - 1, 0).End(xlUp).Offset(1, 0)
End If
Next
Next mycell
end sub ```
I want the rest of the data to be transferred to sheet 5 when exiting the loop below