passing reference arguments to VBA function

  • Thread starter Thread starter Mezon
  • Start date Start date
M

Mezon

Hi,
Does anyone know how to pass/program the use of the :,
the (space), and the , (comma) reference designation
syntax conventions available to intrinsic Excel funtions
to a single VBA function?
Thanks
 
Excel takes care of resolving arguments in the command line. You just
process the results.

For dynamic arguments, one usually uses the parmarray. You then loop
through the array and check the type of each argument and process
accordingly.

As an example with the UDF

Public Function InterpretResults(varr)
msg = TypeName(varr)
If msg = "Range" Then
msg = msg & varr.Address
End If
InterpretResults = msg

End Function

then in the worksheet I have the formula

=InterpretResults(B5:G5 C2:C8)

and the cell displays

Range$C$5
 
Thanks Tom, I'll give it a try. John

Tom Ogilvy said:
Excel takes care of resolving arguments in the command line. You just
process the results.

For dynamic arguments, one usually uses the parmarray. You then loop
through the array and check the type of each argument and process
accordingly.

As an example with the UDF

Public Function InterpretResults(varr)
msg = TypeName(varr)
If msg = "Range" Then
msg = msg & varr.Address
End If
InterpretResults = msg

End Function

then in the worksheet I have the formula

=InterpretResults(B5:G5 C2:C8)

and the cell displays

Range$C$5
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top