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
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
相关文章推荐
- 【037】Excel 中遍历修改文件(VBA)
- Excel VBA遍历所有sheet创作目录并超链接,无视特殊符号
- 利用VBA遍历Excel所有sheet的例子
- vba打开excel文件遍历sheet的名字和指定单元格的值
- EXCEL-VBA:递归遍历文件夹及子文件夹中的文件
- Excel VBA - 遍历某个文件夹中文件、文件夹及批量建立txt
- Excel VBA 遍历单元格 单元格读取
- VBA遍历当前目录下指定类型的excel文件并复制文件内指定的内容到新表中
- Excel VBA - 遍历某个文件夹中文件、文件夹及批量建立txt
- Excel VBA 遍历单元格 单元格读取
- Excel VBA - 遍历某个文件夹中文件、文件夹及批量建立txt(转载)
- Office 2003 VBA 遍历目录下的Excel批量拷贝Sheet 组成一个大的Excel文件
- Excel VBA 遍历目录下所有文件
- 如何在 Visual Basic 或 VBA 中使用 ADO 来处理 Excel 数据
- VBA - 设置EXCEL列名为数字
- Excel 中 vbA 获得有效行数的方法
- VBA Excel 提取有用的列并作列排序
- 重大改变!Python 或将取代 VBA 成为 Excel 官方脚本语言
- Excel VBA 循环“我中毒了~”
- 一个简单的Excel VBA 运用程序----录制宏