以下代碼在第一張紙上刪除太多,然後不循環到第二張紙?出現在.FindNext語句上的錯誤。代碼沒有循環遍歷表
Sub FindAndExecute3()
Dim Loc As Range
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
With sh.UsedRange
Set Loc = .Cells.Find(What:="AUTO.WHSE.")
If Not Loc Is Nothing Then
Do Until Loc Is Nothing
Rows(ActiveCell.Row & ":" & (ActiveCell.Row + 2)).Delete
Set Loc = .FindNext(Loc)
Loop
End If
End With
Set Loc = Nothing
Next
End Sub
如果你不告訴自己想要用你的代碼實現什麼功能,我們怎麼知道什麼是不正確的?你能提供錯誤的文字嗎? – moffeltje