Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Wed, 10 Jun 2009 04:43:01 -0700, Barb Reinhardt
wrote: I have a user defined function and at times I want it to return =NA() in the cell. How do I do this? I can get it to return a text string, but not a formula. Thanks, Barb Reinhardt A function can only return a value. If you want to set a formula into the cell, you'll need to use a different method (e.g. Sub). However, if having your formula return the #NA error (not the string; the error) is acceptable, then you could set your result equal to CVErr(xlErrNA). The only potential caveat is that you'd need to use a variant for your result. e.g: ====================== Function FooBar() As Variant FooBar = CVErr(xlErrNA) End Function ==================== --ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Return date if in range, else return blank | Excel Worksheet Functions | |||
Compare Value in Cell 1 to a List, Return Value if Match otherwise Return Null | Excel Discussion (Misc queries) | |||
LOOKUP and return the column heading for IF/THEN return for False | Excel Discussion (Misc queries) | |||
check if reference exists, then return its value or return 0 | Excel Worksheet Functions | |||
VBA Syntax for VLOOKUP to return array of return values | Excel Programming |