ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   delete rows where value in Column B=0 (https://www.excelbanter.com/excel-programming/405829-delete-rows-where-value-column-b%3D0.html)

sek0910

delete rows where value in Column B=0
 
I have a worksheet with 2 columns and 21585 rows.
I want to delete all of the rows where there is a value of "0" in column B.
Any suggestions?

Thanks,
Steve

sek0910

delete rows where value in Column B=0
 
NEVER MIND, I FIGURED IT OUT

I just filtered for "0", selected all the rows, then deleted them.

Mike H

delete rows where value in Column B=0
 
Maybe

Sub Macro2()
lastrow = Cells(Rows.Count, "B").End(xlUp).Row
For x = lastrow To 1 Step -1
If IsNumeric(Cells(x, 2).Value) And Cells(x, 2).Value = 0 Then
Rows(x).EntireRow.Delete
End If
Next
End Sub

Mike

"sek0910" wrote:

I have a worksheet with 2 columns and 21585 rows.
I want to delete all of the rows where there is a value of "0" in column B.
Any suggestions?

Thanks,
Steve



All times are GMT +1. The time now is 09:33 AM.

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