0
我运行时出现运行时错误91。谁能告诉我我要去哪里?运行时错误91当试图找到
Sub deletingstuff2()
Application.ScreenUpdating = False
Dim i As Long, lngEndRowInv As Long, wsh As Worksheet
Set wsh = ThisWorkbook.ActiveSheet
i = 1
lngEndRowInv = wsh.Range("C" & Rows.Count).End(xlUp).Row **<<ERROR IS HERE**
While i <= lngEndRowInv
If Cells(i, "C") = "Blue" Then
Cells(i, "C").EntireRow.Delete
ElseIf Cells(i, "C") = "Diamond" Then
Cells(i, "C").EntireRow.Delete
i = i - 1
lngEndRowInv = lngEndRowInv - 1
End If
i = i + 1
Wend
end sub
发现错误更改以下内容: 设置wsh = ActiveSheet 谢谢! – User124726 2012-01-29 17:58:14
而不是循环,你认为自动过滤器,然后删除?它比循环快得多:) – 2012-01-29 18:29:04