我有以下代码,它将根据第一列中的条件删除行:
Sub Strip()
Dim rng As Range
With ActiveSheet
.Columns("I").AutoFilter Field:=1, Criteria1:="=70-79%", VisibleDropDown:=False
Set rng = .AutoFilter.Range
End With
If rng.Columns("I").SpecialCells(xlCellTypeVisible).Count - 1 > 0 Then
Application.DisplayAlerts = False
rng.Offset(1, 0).SpecialCells(xlCellTypeVisible).Delete
Application.DisplayAlerts = True
End If
rng.AutoFilter
End Sub
我有关于100
我想以这种方式采取行动的不同标准。我不想重复这段代码100
次,所以谁能告诉我如何以数组的形式对其进行编码?我尝试了各种方法,但似乎无法使其发挥作用。
Use
.Columns("I").AutoFilter Field:=1, Criteria1:=MyArray, Operator:=xlFilterValues
Where MyArray
是一个字符串数组
Example
Dim MyArray(1 To 4) As String
MyArray(1) = "This"
MyArray(2) = "is"
MyArray(3) = "an"
MyArray(4) = "array"
'
'~~> Rest of code
'
.Columns("I").AutoFilter Field:=1, Criteria1:=MyArray, Operator:=xlFilterValues
'
'~~> Rest of code
'
截屏
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)