View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Matilda Matilda is offline
external usenet poster
 
Posts: 57
Default function call not returning changed value


Indeed! Thanks Nick. I have to say that I'm a lot closer to understanding
the whole picture now, you have managed to simplify and clarify in a way that
the textbooks have not so far! Especially when to use byVal and byRef. Am
definitley not ready for the finer points, but alert to them and shall put
your advice in my stash.

Hope this is reaching a wider audience as well...

Thankyou again

Matilda



"NickHK" wrote:

Matilda,
It does take a little practice. And there are some finer points to the
situation that will confuse you if/when you come across them.
<Ignore until later if desired
Like passing an argument ByVal when it is declared ByRef in the function.
And using brackets or not when passing arguments.
</End Ignore

When passing an variable to a sub or function, decide if that variable needs
to be updated inside the called routine.
If Yes, pass ByRef.
If No (you only need to use its value), pass ByVal.
ByRef is the default if specify neither.

NickHK