I'm looking for some advice on the optimal method for identifying and grouping array elements. The array contains three elements as follows:
Option Base 1 Dim myArray(3, 10) as String myArray(1,1) = "ABC Co" myArray(2,1) = "123456" myArray(3,1) = "Beans" myArray(1,2) = "ABC Co" myArray(2,2) = "234567" myArray(3,2) = "Carrots" myArray(1,3) = "ABC Co" myArray(2,3) = "345678" myArray(3,3) = "Lettuce" myArray(1,4) = "XYZ Co" myArray(2,4) = "456789" myArray(3,4) = "Mustard" myArray(1,5) = "XZY Co" myArray(2,5) = "567890" myArray(3,5) = "Beef" myArray(1,6) = "123 Co" myArray(2,6) = "678901" myArray(3,6) = "Ice Cream" myArray(1,7) = "456 Co" myArray(2,7) = "789012" myArray(3,7) = "Bread" myArray(1,8) = "456 Co" myArray(2,8) = "890123" myArray(3,8) = "Lemonade" myArray(1,9) = "789 Co" myArray(2,9) = "901234" myArray(3,9) = "Plates" myArray(1,10) = "654 Co" myArray(2,10) = "012345" myArray(3,10) = "Cups"
There are two issues:
1. The array contains duplicate entries of the first element - myArray(1,x). I need to populate a combo box containing unique items only from this element - no duplicates. Is a simple comparison the best approach? Or is there a built-in VBA function that will return unique items?
2. Once the user selects an item from the combo box, I need to populate a list box with all the elements myArray(2,x) and myArray(3,x) where myArray(1,x) equals the user's selection. Again, is a simple comparison the best way?
Thanks for any advice or suggestions.
Cheers,
James





Reply With Quote