您的位置:首页 > 编程语言 > VB

VBA -excel --遍历行

2016-12-09 17:07 246 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: