I have tried to write code to delete rows containing zeroes in Col B & C, but only the first row containing zeroes are deleted
See my code below
It would be appreciated if someone could assist me
Book1 | |||||
---|---|---|---|---|---|
B | C | D | |||
2 | 0 | 0 | 8 | ||
3 | 0 | 0 | 32.536 | ||
4 | KR-3414 | -389.984 | -2599.9 | ||
5 | KR-3414 | 389.9844 | 2599.896 | ||
6 | KR-3424 | -714.783 | -4765.22 | ||
7 | KR-3424 | 714.7828 | 4765.217 | ||
8 | KR-2510 | -714.783 | -4765.22 | ||
9 | KR-2510 | 714.7828 | 4765.217 | ||
10 | KR-3424 | -714.783 | -4765.22 | ||
11 | KR-3424 | 714.7828 | 4765.217 | ||
12 | 0 | 0 | 10 | ||
13 | KR-2210 | 1.2524 | 92.4368 | ||
14 | KR-7350 | 69.9504 | 466.336 | ||
Sheet1 |
See my code below
Code:
Sub Delete_Zero_Values()
Dim lr As Long, cell As Range
With Sheets(1)
.Application.ScreenUpdating = False
lr = .Cells(.Rows.Count, "A").End(xlUp).Row
For Each cell In .Range("B2:C" & lr)
If cell = 0 Then cell.EntireRow.Delete
Next cell
.Application.ScreenUpdating = True
End With
End Sub
It would be appreciated if someone could assist me
Last edited: