I have written a function
findNewNominal(NomCode as Integer) as Variant
if x exists in a certain range
findNewNominal = an integer corresponding to nomCode
else
findNewNominal = "Nominal Code does not exist"
So in conclusion my variant is either an integer or text
Now when calling this function (i never know in advance whether text or an
int will be returned)
I sometimes want the negative result of the integer returned.
So in some cells i say = - findNewNominal(a number)
This fine provided an integer is returned.
However I want it obvious when the function reports a nominal code could not
be found. The
problem is the '-' turns the text (Nominal Code Not Found) to a 0 (so it
looks like the integer zero has been returned when in fact the nominal
code couldnt be found.
Is there anyway of returning a variant type in my function when if it text,
it is still displayed as such and not
effected by the preceding minus to the function call.
(i cannot really remove the minus, as if an int is to be returned i need on
certain occassions the reverse sign of this)
Many thanks
James
Bookmarks