您可以看到我的代码,当我第一次单击按钮时,数据结果显示在第2行,但是我希望我的结果显示在第5行,但是当我第二次单击按钮时,结果开始在第5行显示,但第一次仍然显示第2,3 ...行数据,无论如何要避免结果在第一次显示第2,3 ...行
搜索将从“其他”选项卡的第2行开始,但是我希望我的工作表摘要选项卡的结果显示从第5行开始
Sub All_N()
Dim wsSum As Worksheet
Dim ws As Worksheet
Dim a As Long, b As Long
Set wsSum = ActiveWorkbook.Sheets("sum")
With wsSum
.Range("A5:T" & .Rows.Count).ClearContents
b = 5
For Each ws In ActiveWorkbook.Worksheets
If ws.Name <> "sum" Then
For a = 2 To ws.Cells(ws.Rows.Count, "T").End(xlUp).Row
If ws.Cells(a, "T") = "N" Then
.Cells(b, 1) = ws.Cells(a, 1)
.Cells(b, 2) = ws.Cells(a, 2)
.Cells(b, 18) = ws.Cells(a, 18)
.Cells(b, 19) = ws.Cells(a, 19)
.Cells(b, 20) = ws.Cells(a, 20)
b = b + 1
End If
Next a
End If
Next
End With
End Sub