View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Niek Otten Niek Otten is offline
external usenet poster
 
Posts: 3,440
Default Influence of IsEmpty function

Please post all code


--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Wamme" wrote in message
...
Hi,

When updating the code of an old (working) UDF I tried to make it more
user-friendly by changing a part of the code with the "IsEmpty( ...)"
function.
But after this modification the UDF would only return a "0" when
referenced
by a cell containing a formula.

I changed the UDF back to its original code but can't figure out tried
what
happens with the code when using "IsEmpty(...)". The problem of returning
0
arrises as soon as I add "IsEmpty(...)" in the code. Even when it's only
used
in a Debug.Print statement (ex. "Debug.Print isEmpty(UDFargument)")

Does the IsEmpty function do anything more dan returning "True" for a
blank
cell or "False" ?


Original code:
If TypeName(Argument) = "Range" Then
Argument = Cell
....
ElseIf ...
Argument = number
End If

When argument is a cell containing a formula: "=A1^2+3*A1+1"
= returns expected value

Changed to:
If IsEmpty(Argument) Then
Argument is cell with not evaluated formula
...
End If

or

Debug.Print IsEmpty(Argument)
If TypeName(Argument) = "Range" Then
Argument = Cell
....
ElseIf ...
Argument = number
End If


When argument is a cell containing a formula: "=A1^2+3*A1+1"
= returns 0