Using VBA to delete rows based off of various criteria

RBVakarian

New Member
Joined
Dec 16, 2016
Messages
3
Hello all, i need some VBA for a large file. I need to delete all the rows that meet any one of these requirements:
Column E = "Z"
Column AD > 0
Column AJ > 0

Thanks for helping!
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
This is what i have so far

Sub Scrubadub() Application.ScreenUpdating = False
Dim LastRow As Long
Dim rng As Range
LastRow = ActiveSheet.UsedRange.Rows.Count
For Lrow = LastRow To Firstrow Step -1
If Cells(Lrow, "AJ").value < 0 Or Cells(Lrow, "AD").value < 0 Or Cells(Lrow, "e").value = "z" Then
'mark for deletion
End If
Next
'delete
Application.ScreenUpdating = True




End Sub
 
Upvote 0

Forum statistics

Threads
1,216,303
Messages
6,129,984
Members
449,550
Latest member
LML2892

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