【发布时间】:2020-12-03 00:04:43
【问题描述】:
我使用记录宏创建了一些代码,然后将其放入循环中。它可以工作,但是 find 函数中有一个错误,导致它只能工作一次。我试图对错误做一些事情,但我没有任何运气让它循环。我在这里和那里看了几天,但我不知所措。希望您能够帮助我。非常感谢。
i = 1
On Error GoTo notfound
Do While Sheet1.Cells(i, 1) <> ""
Columns("J:J").Select
Selection.Find(What:="x", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Rows(ActiveCell.Row).EntireRow.Delete
notfound: msgbox "Finished"
GoTo notfound
Exit Sub
i = i + 1
Loop
【问题讨论】:
-
你能描述一下你想让代码做什么吗?