detect invalid cell reference

  • Thread starter Thread starter ilyaskazi
  • Start date Start date
I

ilyaskazi

This message shows on cell while moving cursor over to it:

"Moving or deleting cells caused an invalid cell reference, or functio
is returning reference error"

and in cell, value is somewhat like this: "#REF!"

In my vba automation program due to this it halts on this point wit
END or DEBUG message box.

I need to detect this type of value to display error msgbox instea
halting with debug.

In my activesheet, detect this type of value containing in cell
 
Iyaskazi,

If you are performing an action one cell at a time, you can test for the
"#REF!" and skip if necessary, for example:

Sub test()
Dim cell As Range

For Each cell In Range("A1:A10")
If InStr(1, cell.Text, "#REF") = 0 Then
cell.Value = cell.Value + 1
End If
Next cell
End Sub

hth,

Doug
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top