- Sub 查找TEST()
- Dim s As String, i%, x%
- For x = 1 To Sheets("Sheet2").[a65536].End(xlUp).Row
- s = Sheets("Sheet2").Cells(x, 1)
- Sheets("Sheet1").Select
- For n = 1 To Range("a1").End(xlDown).Row
- On Error Resume Next
- Cells.Find(What:=s, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
- xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False).Activate
- i = Sheets("Sheet3").[a65536].End(xlUp).Row + 2
- If i < 4 Then i = 1
- ActiveSheet.Range(ActiveCell.Address).CurrentRegion.Cut Sheets("Sheet3").Cells(i, 1)
- Next n
- Next x
- End Sub
复制代码 |