Delete Range if contains String

JaysonHughes

New Member
Joined
Jul 13, 2022
Messages
23
Office Version
  1. 2021
Platform
  1. Windows
If Sheet "40"



if column BB Contains "Small" or "Medium" or "Large" or "HeavyBulky"

Delete AM:BD

NOT EntireRow

If have the following but it dose not loop and delete the EntireRow:


Sub TSI_Keep_Decant()
'
Dim SheetName As Long
'
Application.ScreenUpdating = False
'
For SheetName = 40 To 40 '
On Error GoTo NotFound
With Sheets(CStr(SheetName))
With .Range("BB2:BB" & .Range("B" & .Rows.Count).End(xlUp).Row)
.Value = Sheets(CStr(SheetName)).Evaluate("IF(" & .Address & "=""Small""," & .Address & "=""Medium""," & .Address & "=""Large""," & .Address & "=""HeavyBulky""," & .Address & ",""#N/A"")") '
.SpecialCells(xlConstants, xlErrors).EntireRow.Delete
End With
End With
NotFound:
On Error GoTo -1
Next

Application.ScreenUpdating = True
End Sub
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Screenshot 2022-11-06 140724.png
 
Upvote 0
So if BB = Small" or "Medium" or "Large" or "HeavyBulky" delete between AM:BD on the row.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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