Sub DeleteRows()
Dim c As Range
Dim SrchRng As Range
Dim SrchStr As String
Set SrchRng = ActiveSheet.Range("b1", ActiveSheet.Range("b65536").End(xlUp))
SrchStr = Range("k1")
Do
Set c = SrchRng.Find(SrchStr, LookIn:=xlValues)
If Not c Is Nothing Then c.EntireRow.Delete
Loop While Not c Is Nothing
End Sub
答案 0 :(得分:0)
也许是这样
Sub DeleteRows()
Dim c As Range
Dim SrchRng As Range
Dim SrchStr As String
Dim sh As Worksheet
For Each sh In ActiveWorkbook.Worksheets
Set SrchRng = sh.Range("b1", sh.Range("b65536").End(xlUp))
SrchStr = sh.Range("k1")
Do
Set c = SrchRng.Find(SrchStr, LookIn:=xlValues)
If Not c Is Nothing Then c.EntireRow.Delete
Loop While Not c Is Nothing
Next
End Sub