how to test if range object target deleted
I did the following:
Sub test()
Dim cell As Range
Set cell = ActiveCell
ActiveCell.EntireRow.Delete
If cell Is Nothing Then
MsgBox "row deleted"
Else
MsgBox "cell variable is not nothing!"
End If
End Sub
The answer I got was "cell variable is not nothing!".
Question: how to check for the variable cell no longer existing? I know I
can do the following:
dim anyS as string
on error resume next
anys =""
anys = cell.address
on error goto 0
if anys ="" then
msgbox "cell is nothing"
end if
But there should be a cleaner way! Excel 2003
Bob
|