VBA根据关键字删除整行

请注意,本文编写于 352 天前,最后修改于 31 天前,其中某些信息可能已经过时。

Sub 删除行()
Dim r As Integer
Dim i As Integer, rng As Range
With Sheet1
r = .Cells(Rows.Count, 1).End(xlUp).Row
For i = r To 2 Step -1
    If .Cells(i, 4) = "翠云" Then
        If rng Is Nothing Then
        Set rng = .Rows(i)
    Else
        Set rng = Union(rng, .Rows(i))
    End If
    End If
Next i
rng.Delete
End With
End Sub

Excel,为何我在学校就不多鼓捣鼓捣呢?出来上班,不懂这玩意真的累死人

添加新评论