View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
mudraker[_216_] mudraker[_216_] is offline
external usenet poster
 
Posts: 1
Default Delete Rows - adding a second condition

TP

I don't understanf Bob's code as to why he is using left & mid strin
commands as your original post does not appear to be asking to match o
part of what is in column l


try this simpler code on a backup copy

Code looks in column F if no match on "NE", "NW", "SW", "SE"
looks at column L for "criteria1", "criteria2", "criteria3"
"criteria4"
if no match deletes entire row




Private Sub DeleteRows()
Dim lRow As Long
' used range is base on column A
' if a row is valid, it must have a location in column F
For lRow = Cells(Rows.Count, "a").End(xlUp).Row To 1 Step -1
Select Case Cells(lRow, "F").Value
Case "NE", "NW", "SW", "SE"
'do nothing
Case Else
Select Case Cells(lRow, "L").Value
Case "criteria1", "criteria2", "criteria3", "criteria4"
'do nothing
Case Else
Rows(lRow).Delete
End Select
End Select
Next lRow
End Su

--
Message posted from http://www.ExcelForum.com