LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
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/



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Rows based on condition Vic Excel Discussion (Misc queries) 2 August 18th 09 08:54 PM
Delete rows with date more than 48 hours with a condition.. Kashyap Excel Worksheet Functions 4 February 5th 09 03:51 AM
Macro to delete rows based on a condition Darrilyn Excel Worksheet Functions 1 September 6th 07 12:12 AM
how do I delete all rows that match a condition? djhs63 Excel Worksheet Functions 5 March 16th 05 03:55 PM
delete rows with certain condition Grey Excel Programming 2 December 19th 03 12:05 PM


All times are GMT +1. The time now is 08:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"