List of items in an array - VBA?
Hello
Excel 2003 query around VBA and how you access a Range
Consider two cols of data with people's favourite colour
A B
1) Fred Red
2) Sid Red
3) Bob Blue
4) Andy Reg
5) Steve Blue
What I want is to write the following
=funcWhoCol(A1:B5,"Blue")
The function will return a string containing the names of people whose
favourite colour matches the second parameter, in this case the strung
returned would be "Bob Steve"
I started to create a function and pass the range in as the first param
and the match string as the second but I can't find how to manipulate
the range in my function.
What I want is logically as shown below (although I have no idea about
how to do it so the code is nonsense)
function funcWhoCol is (inRange, inMatch)
for i_count = 1 to inRange.Cells.Count
if inRange(i_count) = inMatch then funcWhoCol = funcWhoCol +
inRange(i_count) + " "
next i_count
end function
Many thanks in advance
Craig
|