Delete rows based on value...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi...

I have 4000 vertical records. In columns A, B and C I have product
information. In column D I have a value that ranages from 0-5. I need to
delete all rows were the value in cell D is 0 (zero). Has anyone got any
useful code? I'm stuck and my brain is bleeding!

Thanks in advance G
 
Sub DeleteRows()
Dim lRow as Long 'Last Row
Dim cnt as Long
lRow = Range("D" & Rows.Count).End(xlUp).Row
For cnt = lRow to 1 Step - 1
If Range("D" & cnt) = 0 Then Rows(cnt).Delete
Next
End Sub

HTH

Charles Chickering
 
select the data, do data =>filter=>Autofilter

in the dropdown for D, select zero.

select all the records (except the header row) and delete

if you need code, turn on the macro recorder while you do it manually.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top