From where is my UDF called?
Hmmmm....
I may have asked my question the wrong way - sorry - English is not my
native language...
What I meant was:
Say, I call my function from a worksheet the usual fasion:
=MyFunction(Some argument)
The function will always return False
....but, if I call the function from another macro, like:
MyVar = MyFunction(Some argument)
The function will return what ever result the function might calculate.
CE
Den 10.05.2013 15:50, GS skrev:
Hi,
Is it possible to test, if a function (UDF) is called from a worksheet
(as a normal worksheet function) or from another macro/VBA code?
Thanks,
CE
Yes and yes! Use it in a cell in the normal fashion, or call it from
VBA. Note that the UDF must be located in a standard module and scoped
public. In the case of a worksheet formula, include the following line
at the top (inside) of your function...
Application.Volatile
...to include it when Excel auto calcs.
|