View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.programming
Jac Tremblay[_4_] Jac Tremblay[_4_] is offline
external usenet poster
 
Posts: 99
Default Function to return two values

Hi RD,
That is a good idea. I will check that out.
Thank you.
--
Jac Tremblay


"RDFischer" wrote:

Jac,

A function is specifically designed to return a single value. A
subroutine on the other hand can change many values. So you could use a
subroutine with two parameters, one a string and the other a boolean...

For example:

sub not_a_function(xstring as string, xbool as boolean)
...statements
xstring = "this is a string"
xbool = true
end sub

RDF

"Jac Tremblay" wrote in message
...
Hi,
Is it possible to create a function that will return two values, a boolean
and a string?
I need to exit the main procedure if the data checked by the function is
not
valid and also display a message according to the particular validation.
For example:
If Not DataIsValid Then
Msgbox strErrorMsg ' Returned from the function
Exit Sub
end IF
Thanks
--
Jac Tremblay