View Single Post
 
Old 01-24-2025, 01:27 PM
p45cal's Avatar
p45cal p45cal is offline Windows 10 Office 2021
Expert
 
Join Date: Apr 2014
Posts: 947
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

Quote:
Originally Posted by gmaxey View Post
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?
Reply With Quote