|
Option Explicit
Sub TEST2()
Dim ar, i&, regEx As Object, Rng As Range, iMsg As Long
Set regEx = CreateObject("VBScript.RegExp")
With regEx
.Global = True
.Pattern = "^增值税"
End With
With Sheets(1)
.Activate
With .[A1].CurrentRegion
ar = .Value
For i = 2 To UBound(ar)
If regEx.test(ar(i, 3)) Then
If Rng Is Nothing Then
Set Rng = .Rows(i)
Else
Set Rng = Union(Rng, .Rows(i))
End If
End If
Next i
End With
End With
If Not Rng Is Nothing Then
Rng.Select
iMsg = MsgBox("需要删除的已选定,按是删除", vbExclamation + vbYesNo, "!!!")
If iMsg = vbYes Then Rng.EntireRow.Delete
End If
Set Rng = Nothing
Set regEx = Nothing
Beep
End Sub
|
|