Thread
:
Delete Row Select Case
View Single Post
#
4
Posted to microsoft.public.excel.programming
Don Guillett
external usenet poster
Posts: 10,124
Delete Row Select Case
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
Reply With Quote
Don Guillett
View Public Profile
Find all posts by Don Guillett