+ Reply to Thread
Results 1 to 6 of 6

Filter Array for ComboBox

Hybrid View

  1. #1
    Registered User
    Join Date
    11-09-2007
    Posts
    42

    Cool Filter Array for ComboBox

    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

  2. #2
    Registered User
    Join Date
    11-09-2007
    Posts
    42

    Re: Filter Array for ComboBox

    So, am I to take it my quandry surpasses this forum's vast knowledge-base????

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,671

    Re: Filter Array for ComboBox

    From help, Filter requires a zero based one dimensional array; however, you have initialized your array with two dimensions.
    Ben Van Johnson

  4. #4
    Registered User
    Join Date
    11-09-2007
    Posts
    42

    Re: Filter Array for ComboBox

    ok, so that doesn't work. Other than looping the array to delete lines, is there no alternative?

  5. #5
    Registered User
    Join Date
    11-09-2007
    Posts
    42

    Re: Filter Array for ComboBox

    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?

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Filter Array for ComboBox

    It does, but I don't have a suggestion other than looping.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1