ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting Rows based on multiple criteria (https://www.excelbanter.com/excel-programming/381016-deleting-rows-based-multiple-criteria.html)

[email protected]

Deleting Rows based on multiple criteria
 
The piece of code I have right now is below
********************
Dim rng1 As Range
Dim what1 As String
what1 = "Elink Test Company 1"
Do
Set rng1 = ActiveSheet.UsedRange.Find(what1)
If rng1 Is Nothing Then
Exit Do
Else
Rows(rng1.Row).Delete
End If
Loop

Dim rng2 As Range
Dim what2 As String
what2 = "Elink Test Company 2"
Do
Set rng2 = ActiveSheet.UsedRange.Find(what2)
If rng2 Is Nothing Then
Exit Do
Else
Rows(rng2.Row).Delete
End If
Loop
********************


I have this piece of code already but I'd rather piece the two together
rather than separate it. I also have 6 other strings to delete as well.


Any help would be great!



All times are GMT +1. The time now is 06:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com