using INSTR to delete certain text whether in Upper or lower case

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,561
Office Version
  1. 2021
Platform
  1. Windows
I have code to delete text , but need it amended so that if the text is in upper, lower or a combination of upper and lower case, the rows containing the text will be deleted

your assistance in resolving this is most appreciated



Code:
 Sub Del_Unwanted()

Sheets(1).Select
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
finalrow = Cells(65536, 1).End(xlUp).Row
For i = finalrow To 2 Step -1
If InStr(Cells(i, 8).Value, "Polo") Or InStr(Cells(i, 8).Value, "BRT Lyland") Or InStr(Cells(i, 8).Value, "EPR KIN") Or InStr(Cells(i, 8).Value, "EAS Trase") Then

Cells(i, 8).EntireRow.Delete
End If

Next i
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
End Sub
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Try doing it like
Code:
InStr(1,Cells(i, 8).Value, "Polo",vbTextCompare)
 
Upvote 0
Thanks for the help. Code works perfectly
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,202
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top