View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Passing Parameters to Userdefined Functions

Assuming your range is a contiguous range of cells:

Function Dosomething(names as string, rng as Range)
Dim cell as Range
for each cell in rng
if cell.value = names then


--
Regards,
Tom Ogilvy

"Peter M" wrote in message
...
I want to create a userdefined function that will be assigned to

parameters:
1. a cell containing a string, 2. a range of cells containing a variety of
data. The contents of the string will be parsed and then compared with

the
range of data. The actual processing is not the problem, and I can easily
create the passing mechanism for the string variable, but I dont know how

to
pass an area of the spreadsheet to the function. I have tried something
like:

function dosomething(names as string, paramarray DataArea)
code here
end func

It compiles and seems to work, but nothing appears in the DataArea

variable
(or if it does I cant access it!).

Any ideas gratefully received.

Peter Morris