Macro Needed (=<0)

ironsides

Well-known Member
Joined
Aug 12, 2002
Messages
575
Start on Line 11

Search Col AD

Delete all lines having value of =<0

leave cursor in last line of Col AD
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
How about just autofiltering for <0, then clear all the unfiltered cells?
 
Upvote 0
try below
Code:
Sub Row_DEL()
Dim lr As Integer
lr = Range("AD" & Rows.Count).End(xlUp).Row
For i = lr To 1 Step -1
If Cells(i, 30).Value <= 0 Then Cells(i, 30).EntireRow.Delete
Next i
Range("AD" & Rows.Count).End(xlUp).Select
End Sub
 
Last edited:
Upvote 0
try below
Code:
Sub Row_DEL()
Dim lr As Integer
lr = Range("AD" & Rows.Count).End(xlUp).Row
For i = lr To 1 Step -1
If Cells(i, 30).Value <= 0 Then Cells(i, 30).EntireRow.Delete
Next i
Range("AD" & Rows.Count).End(xlUp).Select
End Sub


It only removed 6 out of 200 lines
and it should start from line 11 towards the bottom of the sheet.
 
Upvote 0
try below
Code:
Sub Row_DEL()
Dim lr As Integer
lr = Range("AD" & Rows.Count).End(xlUp).Row
For i = lr To 1 Step -1
If Cells(i, 30).Value <= 0 Then Cells(i, 30).EntireRow.Delete
Next i
Range("AD" & Rows.Count).End(xlUp).Select
End Sub


It only removed 6 out of 200 lines
and it should start from line 11 towards the bottom of the sheet.
 
Last edited:
Upvote 0
can you pls upload your excel file in any sharing site and paste the link here ? that would be easy for me bcoz that same code working in my file
 
Upvote 0
Hi,

If you want to start from line 11, then change this line

For i = lr To 1 Step -1

to

For i = lr To 11 Step -1

Jai
 
Upvote 0

Forum statistics

Threads
1,207,391
Messages
6,078,215
Members
446,321
Latest member
thecachingyeti

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