+ Reply to Thread
Results 1 to 5 of 5

Create Dynamic List Property for Combobox - Exclude Certain Values from List

  1. #1
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Office 365
    Posts
    371

    Create Dynamic List Property for Combobox - Exclude Certain Values from List

    I would like to create a list source for my combobox based on the values in column A of worksheet ws_rstr.

    As of now, what is working satisfactorily is :

    Please Login or Register  to view this content.
    I need to enhance this to :

    a) recognize when the reference database expands with the addition of new rows. A3 will always be the start, but column A may grow beyond the static row 37.
    b) the data in column A may contains one or more values = 0. I do not want these included in the list source for the combobox.

    Is anyone able to assist me with this?

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Create Dynamic List Property for Combobox - Exclude Certain Values from List

    In answer to the first question, use a named dynamic range: http://www.utteraccess.com/wiki/Offs...Dynamic_Ranges.

    As for the second, loop against the name
    Please Login or Register  to view this content.
    Also, you might want to consider renaming the combobox to something more meaningful like CB_User_ID or whatever.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Office 365
    Posts
    371

    Re: Create Dynamic List Property for Combobox - Exclude Certain Values from List

    OK, thanks dflak for your guidance!

    In name manager, I created a named range (employeenumber) with a reference based on this forumla:
    Please Login or Register  to view this content.
    where column A of worksheet "roster" hosts the employee numbers intended to populate the combobox of the userform. The data starts at cell A3, (A1, A2 are headers).

    I am populating the contents of the combobox with this code (as part of the userform initialize code)that steps through the named range (employeenumber) extracting all the values with the exception of those = 0.

    Please Login or Register  to view this content.
    I'm not able to determine if this approach is working as the code breaks with the line highlighted in red with an "Unspecified error".

  4. #4
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,293

    Re: Create Dynamic List Property for Combobox - Exclude Certain Values from List

    Please Login or Register  to view this content.
    ???

  5. #5
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Office 365
    Posts
    371

    Re: Create Dynamic List Property for Combobox - Exclude Certain Values from List

    Hi nigelog!

    Please Login or Register  to view this content.
    nets me a "Method or data member not found." error.

    I did find the error with my original code. Once I removed the RowSource property of the combobox "clear" worked. I had forgetten I had that property set.
    Last edited by Jenn68; 02-27-2019 at 11:29 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Create a list of unique values from several columns in a dynamic table.
    By schurchill39 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-28-2018, 06:51 PM
  2. Replies: 5
    Last Post: 04-09-2016, 12:33 PM
  3. [SOLVED] Create ComboBox with list of values from 1 to variable number
    By drrazor in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-03-2014, 08:31 AM
  4. [SOLVED] Combobox - Could not set the List property....
    By siobeh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-30-2013, 01:09 AM
  5. [SOLVED] Create a dynamic search list from user typed values
    By askinner in forum Excel General
    Replies: 10
    Last Post: 11-19-2012, 11:30 PM
  6. setting a combobox list property to a named range
    By matpj in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-06-2012, 11:52 AM
  7. [SOLVED] Combobox List - Which Property
    By teresa in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-05-2005, 12:06 PM

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