BarryL
Well-known Member
- Joined
- Jan 20, 2014
- Messages
- 1,436
- Office Version
- 2019
- Platform
- Windows
- MacOS
Hi All,
I have the below code that deletes everything that is equal to one in column D. I want to add in a condition where it deletes everything equal to one in column D as long as the corresponding row in column B is not blank.
Sub DeleteD1()
Dim LR As Long, i As Long
LR = Range("D" & Rows.Count).End(xlUp).Row
Application.ScreenUpdating = False
For i = LR To 1 Step -1
If Range("D" & i).Value = 1 Then Rows(i).Delete
Next i
Application.ScreenUpdating = True
End Sub
Thank you.
Barry
I have the below code that deletes everything that is equal to one in column D. I want to add in a condition where it deletes everything equal to one in column D as long as the corresponding row in column B is not blank.
Sub DeleteD1()
Dim LR As Long, i As Long
LR = Range("D" & Rows.Count).End(xlUp).Row
Application.ScreenUpdating = False
For i = LR To 1 Step -1
If Range("D" & i).Value = 1 Then Rows(i).Delete
Next i
Application.ScreenUpdating = True
End Sub
Thank you.
Barry