Simplest VBA for Row Deletion in a given worksheet if Column A = FALSE

cubewarrior

New Member
Joined
Dec 11, 2014
Messages
29
Greetings,

I have manage to create the appropriate merging of my data to a single worksheet, and created Column A to validate the row and tell me if "True", then I need the row or "False", I can delete the row.

Is there simple VBA code that can check a given worksheet and delete any row where Column A = False? I am thinking of this as a button macro another worksheet I can activate to perform this action. I have poured over the forums here and did not find this exactly. I am hoping it is simple.

I am on a PC with Excel 2013.

Thank you !

-CW
 
Code:
Sub DeleteFalse()
With ActiveSheet
    .AutoFilterMode = False
    With Range("A2", Range("A" & Rows.Count).End(xlUp))
        .AutoFilter 1, "False"
        On Error Resume Next
        .Offset(1).SpecialCells(12).EntireRow.Delete
    End With
    .AutoFilterMode = False
End With
End Sub
 
Upvote 0
Maybe this for the active sheet.
Paste the code into a Standard Module
Code:
Option Compare Text
Sub MM1()
Dim lr As Long, r As Long
Application.ScreenUpdating = False
lr = Cells(Rows.Count, "A").End(xlUp).Row
For r = lr To 1 Step -1
    If Range("A" & r).Value = "False" Then
        Rows(r).Delete
    End If
Next r
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Glad to help...you'll find if you have a larger data set, that heifer624s code will be more efficient !!.....:beerchug:
 
Upvote 0

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