LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default Delete Macro with OR/ELSE condition

I am a beginner a writing Macros in Excel. I have a Macro that deletes any
record that does not equal "Server/Midrange Software" in column M. I need to
expand this to include other criteria. Such as,

if column M does not equal "Server/Midrange Software" or does not equal
"Data Telecom" then delete the record.

The Macro I have currently is.....

Sub TryMe()
'Deletes rows where the value in column M are not equal to Server/Midrange
Software
Dim RowMdx As Long
Dim LastRow As Long

LastRow = Cells(Rows.Count, "M").End(xlUp).Row

For RowMdx = LastRow To 1 Step -1
If Cells(RowMdx, "M").Value < "Server/Midrange Software" Then
Rows(RowMdx).Delete

End If
Next RowMdx
End Sub

How do I put the OR condition in this for Data Telecom and possibly more
conditions?

Any help appreciated,,,,,,thanks

--
Mike
 
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 Row with condition puiuluipui Excel Discussion (Misc queries) 4 June 12th 09 01:49 PM
Macro to delete rows based on a condition Darrilyn Excel Worksheet Functions 1 September 6th 07 12:12 AM
How to delete lines programmatically if a condition is met? nt_artagnian[_2_] Excel Discussion (Misc queries) 1 March 7th 07 05:39 PM
Is there a way to delete a cell value based on a condition? Peanut Excel Discussion (Misc queries) 2 October 2nd 06 09:55 PM
Can I delete an entire row if condition is not met? Christine Excel Worksheet Functions 8 May 4th 06 09:47 AM


All times are GMT +1. The time now is 01:12 PM.

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"