Thread: byref errors
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Ryan H. Ryan H. is offline
external usenet poster
 
Posts: 15
Default byref errors

I just tried that and I still get a "byref argument type mismatch", which is
a compile error

Let me just mention that wksheet comes from a for each statement as follows:
For Each wksheet In myBook.Sheets





"Chip Pearson" wrote in message
...
Ryan,

If you are not taking the return value of the Foo function, don't
enclose the parameter in parentheses. E.g.,

Foo wksheet


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"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