Delete a an Entire row if it contains "False" in a column

Jpruss99

New Member
Joined
Aug 17, 2023
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am trying to make a 30-Day rolling schedule based on dates for a delivery schedule. I want to be able to delete the rows that show "False" to an =AND statement I wrote if their delivery date is outside my 30-Day rolling calendar.

The AND statement is =AND(D2>=$J$3,D2<=$K$3)
Where;
- D2 is delivery date
- J3 Is =Today()
- K3 is +Today()+30

This statement returns false if that date(D2) is outside of my 30 day range, does anyone know of a formula or code in VBA that will delete entire rows if there is a column containing a text string?

-Cheers
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Welcome to the Board!

Formulas cannot delete data, only return values to the cells that they reside in. So this will require VBA.

What column is this formula that returns FALSE?
I imagine that you have multiple rows that need checking.
What is the address of the first cell in the column that might return this value?
 
Upvote 0
Welcome to the Board!

Formulas cannot delete data, only return values to the cells that they reside in. So this will require VBA.

What column is this formula that returns FALSE?
I imagine that you have multiple rows that need checking.
What is the address of the first cell in the column that might return this value?
Thank you for the warm welcome!

The Column that returns "FALSE" is in E. I want this to read through Rows 2-450. The first cell is E2 that returns False.

-Thanks
 
Upvote 0
Try this VBA code:
VBA Code:
Sub MyDeleteRows()

    Dim r As Long
    
    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
    
    For r = 450 To 2 Step -1
        If (Cells(r, "E") <> "") And (Cells(r, "E") = False) Then Rows(r).Delete
    Next r
    
    Application.Calculation = xlCalculationAutomatic
    Application.ScreenUpdating = True
    
End Sub
 
Upvote 0
Solution
Try this VBA code:
VBA Code:
Sub MyDeleteRows()

    Dim r As Long
   
    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
   
    For r = 450 To 2 Step -1
        If (Cells(r, "E") <> "") And (Cells(r, "E") = False) Then Rows(r).Delete
    Next r
   
    Application.Calculation = xlCalculationAutomatic
    Application.ScreenUpdating = True
   
End Sub
That worked perfectly! Thank you so much
 
Upvote 0
You are welcome.
Glad I was able to help!
 
Upvote 0

Forum statistics

Threads
1,215,092
Messages
6,123,063
Members
449,090
Latest member
fragment

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