delete entire row based on if then value

duwell81

New Member
Joined
Jul 22, 2011
Messages
11
Good Evening,

I have an excel spreadsheet that has 7217 rows and some of the rows in column b have a value of "True" based on an if then statement i used to check for blanks in column c. I simply want to delete the entire row if the value in column b is equal to "True" without having to sort the database on column B which would probaly be easier but i want to leave my data order in tact right now.

Any Help would be great.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
try this in a backup of you data.

Code:
Sub DeleteRows()
'This macro will delete the entire row if there is a data match anywhere in the range.
    Application.ScreenUpdating = False

    With Range("B1:B200")
        .Replace "True", True, xlWhole ' can also use *John* if searching for any part
        .SpecialCells(xlCellTypeConstants, 4).EntireRow.Delete
    End With

    Application.ScreenUpdating = True

End Sub
 
Upvote 0
Autofilter, filter for true in column B, select the range or rows, press delete on the keyboard or right-click and choose delete (to remove the cells too), remove the Autofilter.
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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