Invoking "#REF!" without hardcoding it

  • Thread starter Thread starter Gio
  • Start date Start date
G

Gio

Okay, heres what I'm trying to do. I'm writing a user defined function
in VBA, and I'm trying to invoke the "#REF!" message when the user trys
to pick more than one column and row in the range. Here's the problem,
I can't just hard code "#REF!," it has to be a legit Excel error code
for an invalid cell reference.

HELP PLEASE!!!!!! Thanks.
 
cvErr(xlErrRef)

? cverr(xlErrRef)
Error 2023

to further illustrate:

range("B9").Value = cverr(xlErrRef)
? range("B9").Text
#REF!
? range("B9").Value
Error 2023
 
cvErr(xlErrRef)

? cverr(xlErrRef)
Error 2023

to further illustrate:

range("B9").Value = cverr(xlErrRef)
? range("B9").Text
#REF!
? range("B9").Value
Error 2023
 
Back
Top