ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete rows based on value... (https://www.excelbanter.com/excel-programming/373012-delete-rows-based-value.html)

Gordon[_2_]

Delete rows based on value...
 
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

Ron de Bruin

Delete rows based on value...
 
Hi

Start here
http://www.rondebruin.nl/delete.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Gordon" wrote in message ...
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




Die_Another_Day

Delete rows based on value...
 
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
Gordon wrote:
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



Tom Ogilvy

Delete rows based on value...
 
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.

--
Regards,
Tom Ogilvy



"Gordon" wrote:

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



All times are GMT +1. The time now is 10:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com