Steveng
Steveng

Reputation: 1521

Excel VBA - Function to Detect Invalid Reference

I am new to excel vba. Is there any function that would detect the cell value as #REF!?

Upvotes: 2

Views: 5643

Answers (1)

chris neilsen
chris neilsen

Reputation: 53126

Assuming CellReference references a cell,

To detect any error, use If IsError(CellReference) Then

To detect #REF! specifically use If CellReference = CVErr(xlErrRef) Then

Upvotes: 5

Related Questions