VBA -excel --遍历行

Sub filter1()
Rem MsgBox ("AAAAA")
Rem 1 get selected zone
Rem 2 loop rows and check column
Rem 3 if true then hide it

Dim pos, total

Rem 获取行数
total = Sheet1.UsedRange.Rows.Count

Rem 开始循环
For pos = 1 To Sheet1.UsedRange.Rows.Count
Dim tmpStr

Rem B 列示第二列
tmpStr = Cells(pos, 2)
If InStr(tmpStr, "其他") Then
Range(Cells(pos, 1), Cells(total, 1)).EntireRow.Hidden = True

Exit Sub
End If

Rem MsgBox (tmpStr)
Next

End Sub

上一篇:CentOS 静态IP分配,提示Error, some other host already uses address解决办法


下一篇:[Tex学习笔记]小于等于一个常数乘以...