ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   delete rows with 0 values (https://www.excelbanter.com/excel-programming/373991-delete-rows-0-values.html)

andresg1975

delete rows with 0 values
 
how can i create a macro that select column O, delete every row that contains
empty cells, cells with 0 values, and non-numeric cells such as --------.
thanks

Jean-Yves[_2_]

delete rows with 0 values
 
Sub test
dim rng as range

For each rng in Range("O2", Range("O2").End(xlDown))
If rng.value = "0" or rng.value= "---------"Then rng.clear
Next
columns("O:O").SpecialCells(xlCellTypeBlanks).Enti reRow.Delete
End sub
Regards
Jean-Yves


"andresg1975" wrote in message
...
how can i create a macro that select column O, delete every row that
contains
empty cells, cells with 0 values, and non-numeric cells such as --------.
thanks





All times are GMT +1. The time now is 05:42 PM.

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