Delete Row Select Case
Question.
I'm not a vba guru but why does the code work with declaring i as a
variable, and what is c?
Thanks
On Sat, 19 Jan 2008 14:51:42 -0600, "Don Guillett"
wrote:
Sub deleteif()
For i = Cells(Rows.count, "c").End(xlUp).Row To 2 Step -1
Select Case UCase(Left(Cells(i, "c"), 2))
Case Is = "X1": Rows(i).Delete
Case Else
End Select
Next i
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Little Penny" wrote in message
.. .
I am trying to get this code to delete every row if the value in
column B begins with "X1".
I'm getting a syntax error any help would greatly be appreciated
Error here - Select Case Left((c, 2), 2)
Complete code:
Sub DeleteRowCase()
Dim c As Long
Dim LastRow As Long
Application.ScreenUpdating = False
LastRow = Range("C65536").End(xlUp).Row
For c = LastRow To 2 Step -1
Select Case Left((c, 2), 2)
Case Is = "X1": .EntireRow.Delete
Next c
End Select
Application.ScreenUpdating = True
End Sub
|