#REF! Halting my Macro
Tks Tom for the clarification...
JMay
"Tom Ogilvy" wrote in message
...
Sub DeleteRows()
Dim r As Long
With Selection
For r = .Cells.Count To 1 Step -1
With .Cells(r, 1)
If .Value = 0 Or .Text = "#REF!" Then .EntireRow.Delete
End With
Next
End With
End Sub
will check for #REF specifically
Demo'd from the immediate window:
? activeCell.Text
#REF!
? activeCell.Text = "#REF!"
True
--
Regards,
Tom Ogilvy
JMay wrote in message
news:Kcgbb.4441$AH4.1113@lakeread06...
After selecting a range, say D5:D39
where d20 might have = d25 and d25 is blank
the folowing code is stopping <<HERE-belowon d20 - haven't I provided
for
this?
TIA,
Sub DeleteRows()
Dim r As Long
With Selection
For r = .Cells.Count To 1 Step -1
With .Cells(r, 1)
HERE If .Value = 0 Or .Value = "#REF!" Then .EntireRow.Delete
End With
Next
End With
End Sub
|