detlion1643
Board Regular
- Joined
- Nov 25, 2009
- Messages
- 164
When trying to loop through a column and delete a row based on the cell containing exctly 0 (not sure if it's formatted number or text) it will delete anything with a 0 in it ex) 3402, 403...
I thought instr only found exaclty what's in "", but it's acting similar to Like
I tried using If InStr(1, Rng.Cells(i, 1).Text, "0") Then
but same thing.
Code:
With Worksheets("Sheet1")
Set Rng = .Range("C1", .Cells(.Rows.Count, "C").End(xlUp))
End With
For i = Rng.Rows.Count To 1 Step -1
If InStr(1, Rng.Cells(i, 1).Value, "0") Then
Rng.Cells(i, 1).Select
Rng.Cells(i, 1).EntireRow.Delete shift:=xlUp
End If
Next i
End Sub
I thought instr only found exaclty what's in "", but it's acting similar to Like
I tried using If InStr(1, Rng.Cells(i, 1).Text, "0") Then
but same thing.