I am populating a combobox from a list via VBA where Columns A and B are data and Column C holds a 1 or 0, with 1 being active. Only active data will populate the combobox. I can achieve this via a loop, but it seems more efficient to enter the entire array into memory, filter it, then populate the combobox with the filtered list. However, I cannot determine how to filter the list in memory. Can someone help?
Set vRng = s1.[A1:C6] vArray = Filter(vRng, "1") s1.Test() = vArray
So, am I to take it my quandry surpasses this forum's vast knowledge-base????![]()
From help, Filter requires a zero based one dimensional array; however, you have initialized your array with two dimensions.
---
Ben Van Johnson
ok, so that doesn't work. Other than looping the array to delete lines, is there no alternative?
Yes, the combobox will have two columns. The basis for the combobox is a table with Project#, ProjectName, and Active. Active is a 1 for an active and 0 for an inactive project. I populate the box from this table with only active records. Currently, I loop the table appending data to a two dimensional array that then populates the combobox. However, it seems more logical to take the entire array, filter it for active projects, then apply to the combobox.
Does that makes sense?
It does, but I don't have a suggestion other than looping.
Microsoft MVP - Excel
Entia non sunt multiplicanda sine necessitate
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks