运行时遇到运行时错误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
答案 0 :(得分:2)
显然你的意思是wsh.Rows.Count
,而不是Rows.Count
。