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

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
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,821
Messages
6,132,905
Members
449,768
Latest member
LouBa

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