View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Delete Rows - adding a second condition

Because it wants to test all values from criteria1 to criteria10, and I see
3 tests as simpler than 10.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"mudraker " wrote in message
...
TP

I don't understanf Bob's code as to why he is using left & mid string
commands as your original post does not appear to be asking to match on
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 Sub


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