Macros to Delete Rows in Excel 2007 [Solved/Closed]

- - Latest reply: TrowaD
Posts
2562
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
November 14, 2019
- Mar 22, 2011 at 10:58 AM
Hello,

I want to delete the rows which contains number less than value 1000 in one column.

For instance, I have column AJ which shows the value. I wanted to delete the entire row where column AJ Value contains < 1000.

Please help me on the same.

Thanks in Advance.



See more 

1 reply

Posts
2562
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
November 14, 2019
370
0
Thank you
Hi Shiva,

Try this code:
Sub DeleteRows()
lRow = Range("AJ" & Rows.Count).End(xlUp).Row
Set MR = Range("AJ1:AJ" & lRow)
For Each cell In MR
If cell.Value < 1000 And cell.Value <> "" Then cell.EntireRow.Delete
    Next
End Sub

Do let me know how this works out for you and if any adjustments are needed.

Best regards,
Trowa