|
具体表格内容见附件!
问题类型:
1.我在使用VBA程序删除该表格A列含有FNV关键字的整行时,因是VBA小白,先用简单公司将FNV提取出来;
2.然后在论坛里找到删除指定内容单元格的VBA代码,测试新建一个表格有效;
3.放到我上传的附件里运行,就全部给我删除了;
求求各位大神帮我看一下什么原因。
万分感谢!!!
论坛里找到使用的代码如下:
Sub RowsDelete()
Dim rng As Range, i%, str$, strMyr$
strMyr = "FNV"
For i = 5 To Cells(Rows.Count, 1).End(3).Row
str = IIf(Cells(i, 2) <> "", Cells(i, 2), IIf(Cells(i - 1, 2) <> "", Cells(i - 1, 2), str))
If InStr(strMyr, str) Or Cells(i, 4) = "" Then
If rng Is Nothing Then
Set rng = Cells(i, 1)
Else
Set rng = Union(rng, Cells(i, 1))
End If
End If
Next
If Not rng Is Nothing Then rng.EntireRow.Delete
End Sub
|
|