ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Invoking "#REF!" without hardcoding it (https://www.excelbanter.com/excel-programming/283002-invoking-ref-without-hardcoding.html)

Gio

Invoking "#REF!" without hardcoding it
 

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.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/


Tom Ogilvy

Invoking "#REF!" without hardcoding it
 
cvErr(xlErrRef)

? cverr(xlErrRef)
Error 2023

to further illustrate:

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



--
Regards,
Tom Ogilvy

"Gio" wrote in message
...

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.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/




Gio[_2_]

Invoking "#REF!" without hardcoding it
 

anybody?!!??!?!!?!?


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/


Tom Ogilvy

Invoking "#REF!" without hardcoding it
 
cvErr(xlErrRef)

? cverr(xlErrRef)
Error 2023

to further illustrate:

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



--
Regards,
Tom Ogilvy

Gio wrote in message
...

anybody?!!??!?!!?!?


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/





All times are GMT +1. The time now is 05:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com