Invoking "#REF!" without hardcoding it

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.
 
T

Tom Ogilvy

cvErr(xlErrRef)

? cverr(xlErrRef)
Error 2023

to further illustrate:

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

Tom Ogilvy

cvErr(xlErrRef)

? cverr(xlErrRef)
Error 2023

to further illustrate:

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

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

Top