0

I have got multiple sets of criteria I need to pass into a function in order to check if they exist inside a nested collection. In a similar way as the sumifs worksheet function works, where you enter an unlimited number of criteria ranges and specific criteria, can you do this for a function in VBA?

I was thinking something along the lines of:

Public Function findEntryByCriteria(col As Collection, ParamArray Criteria(Key as Integer, str as String)) as Collection

Is this possible? or would I simply need to allow for a number of optional arguments?

AlxRiash
  • 31
  • 2
  • 1
    You would just do `ParamArray Criteria() as variant` then in the function you would test to make sure it has an even number and then as you loop you would loop `Step 2` and pull the data in pairs. – Scott Craner Nov 03 '20 at 23:37
  • you can see an example here: https://stackoverflow.com/questions/56858571/merge-values-of-column-b-based-on-common-values-on-column-a/56858767 – Scott Craner Nov 03 '20 at 23:39

0 Answers0