Quote:
Originally Posted by gmaxey
So, can I assume that there is no built-in VBA function that would return an array of row indexes? Similar to the return of all the cell addresses given by the Find dialog when "Find All" is chosen.
|
No built-in one, no, but you can do something in vba like:
Code:
x = [TOCOL(IF(A1:A9="Pears",ROW(A1:A9),NA()),3,FALSE)]
which with your data will get you a 2d array x(1 to 3, 1 to 1) which you could transpose to 1d array with
Code:
x = [transpose(TOCOL(IF(A1:A9="Pears",ROW(A1:A9),NA()),3,FALSE))]
However, it matters more what you intend to do with the results whether your function returns a range object or just an array of row numbers, or something else?