+ Reply to Thread
Results 1 to 4 of 4

Populate combo box from filtered data

  1. #1
    Registered User
    Join Date
    12-06-2007
    Posts
    4

    Populate combo box from filtered data

    I have two combo boxes (ComboBox1 and ComboBox2) on an Excel sheet. ComboBox1 is poplulated with data from one column from existing rows of data when the file is opened, which works great. The function of ComboBox1 is to filter the existing rows of data using the ComboBox1_Change event, which also works fine.
    ComboBox2 is populated with data from the filtered rows also using the ComboBox1_Change event. This is working, but it populates ComboBox2 with duplicate data since the unfiltered list contains duplicates. The current code I have to populate ComboBox2 steps through each row rather than only the filtered rows. Is there a way to step through and add only the filtered data to ComboBox2? Below is my current code for populating ComboBox2:
    Please Login or Register  to view this content.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello brodybear,

    The code in blue will give a filtered list with no duplicates.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    12-06-2007
    Posts
    4
    Thanks for the reply Leith. I pasted your code into mine, but when I change ComboBox1, I get the following error: 'AdvancedFilter method of Range class failed' at the below line
    Please Login or Register  to view this content.
    Any ideas what that might be?
    Thanks in advance

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello brodybear,

    Sorry, my typing skills are not so good. Should be...
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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