Hi Ryan,
If you are not retrieving the return value from the function you need to
call it without the parenthesis around the argument:
Foo wksheet
Otherwise, the parenthesis evaluate the argument, which in the case of
objects returns their default value, so passing (wksheet) is actually
passing the name of the worksheet, not a reference to the worksheet.
--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/
* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *
"Ryan H." wrote in message
e.rogers.com...
Hi,
I have a function that accepts the following parameter:
Function Foo(wsheet as Worksheet)
...
...
End Function
when I call the function as in the following:
Foo(wksheet)
I get a ByRef error. Why can I send worksheet as a parameter? I think it
has
something to do with references. The only way I see out of this is to make
the variable global, which offcourse is bad. How can this be done?
Thanks