PDA

View Full Version : Find indices of value and return entire rows of these indices



Mr Phil
09-03-2014, 04:13 AM
Hi All,

I'm new to VBA although I do have a programming background in Python and Matlab.

Could someone help me write a function that finds all the indices of a particular value in a column and then returns the entire row content of each of these indices? I've started writing this function but don't know how to find (and store) all the indices and then subsequently output all these rows.

Thanks and regards,

Phil

Jan Karel Pieterse
09-03-2014, 06:45 AM
It might be useful if you describe in more general terms what your code needs to achieve, probably there is a good "excel-way" of preparing your data...

Mr Phil
09-03-2014, 07:24 AM
Okay.

There are 6 fields/columns... One of these columns contains ID numbers. The idea is to have a function that has 2 inputs : 1. The ID number we'd like to search for; 2. The column we are interested in searching for this ID number (eg. A:A).

If there are 2 instances of this ID the function should output the 2 respective rows of data that contain this ID.

mancubus
09-03-2014, 08:06 AM
perhaps...

http://dailydoseofexcel.com/archives/2010/03/08/getting-array-data-from-a-filtered-list-in-vba/