+ Reply to Thread
Results 1 to 3 of 3

Populate a listbox with unique values from a range on a worksheet

  1. #1
    Forum Contributor
    Join Date
    03-14-2013
    Location
    England
    MS-Off Ver
    2007
    Posts
    186

    Populate a listbox with unique values from a range on a worksheet

    Hi,

    I am asking for help to do with populating a text box on a userform. I have a described example here and I am hoping someone can provide example VBA code based on this. For the purpose of this lets say that..............

    • We have a range of data that exists in column A of a worksheet, the workbook is called 'example1', and the worksheet is called 'sheet1'.
    • There is a header row that we want to ignore and the number of rows of data that exists may vary. So the range to look at is A2 down to the last row in column A that has data in it at the time.
    • The data is text, not numerical values.
    • Each different item of data that exists in this column will be there multiple times.
    • We have a user form called 'userform1', and on it there is a text box called 'textbox1'.


    I want to populate the text box with 1 x each item from column A of the worksheet, ignoring any duplicates (and ignoring the header row).

    Examples of how best to achieve this would be very helpful and much appreciated.

    Thanks in advance.

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Populate a listbox with unique values from a range on a worksheet

    Send a short sample to prepare the text box for you

  3. #3
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Populate a listbox with unique values from a range on a worksheet

    Assuming the source range is in column I and named Listdata as follow
    ListData =OFFSET(Sheet1!$I$1,0,0,COUNTA(Sheet1!$I:$I),1)
    use next code
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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] How do I populate a listbox with a list excluding values found in another listbox?
    By Hokiefan00 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-27-2014, 01:47 PM
  2. Populating a listbox or comobox (validation?) with unique values from large range
    By starfailure in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-12-2013, 11:41 PM
  3. [SOLVED] populate listbox with unique text
    By mcdermott2 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-02-2013, 03:50 PM
  4. [SOLVED] Populate Listbox with a range from one worksheet (criteria) and remove if item found
    By Foreverlearning in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 05-08-2012, 07:31 AM
  5. How to populate multiple column listbox with unique combinations only
    By shuvajit in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-06-2012, 12:37 AM

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