+ Reply to Thread
Results 1 to 3 of 3

Listbox to source two sets of data

  1. #1
    Registered User
    Join Date
    05-21-2014
    Location
    Auckland New Zealand
    MS-Off Ver
    2013
    Posts
    35

    Listbox to source two sets of data

    Hi All.
    I am having trouble with a userform that has a ListBox for Data and a ComboBox that picks which set of data to populate the ListBox.
    If I use the 'ListBox' properties to acquire the row source then I will need two Userforms but I would like to use one form and alternate the ListBox information based on what is selected in the ComboBox.
    Please help.
    Here is my Code.
    Please Login or Register  to view this content.

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Listbox to source two sets of data

    Please Login or Register  to view this content.
    Also you use Listbox2 in your second statement instead of Listbox1.
    Please Login or Register  to view this content.
    Last edited by bakerman2; 06-02-2016 at 10:19 PM.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Registered User
    Join Date
    05-21-2014
    Location
    Auckland New Zealand
    MS-Off Ver
    2013
    Posts
    35

    Re: Listbox to source two sets of data

    Thanks bakerman2.
    This was a big help. I made one change as the code didn't work for me, well two changes (I set the end of the Range as well).
    Your code might work as well but I thought I would add my changes as an option for anyone else looking at doing something similar.

    I swapped - "With ListBox1.Clear" for - With ListBox1.RowSource = ""- I think these do the same thing so thanks again.
    I will be marking this 'Solved' shortly
    Please Login or Register  to view this content.

+ 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. add a new filter in an exisiting listbox with different source table
    By melody10 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-10-2015, 09:26 AM
  2. [SOLVED] Listbox selection back to data source
    By evertjvr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-03-2015, 04:45 PM
  3. ListBox source = (Find an entry, offset by X and up to the end of the used row)
    By lookingforhelp1 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-30-2015, 07:14 PM
  4. Help with Userform Data Source for Listbox refrerencing using full path
    By AuntyJean in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-17-2014, 12:57 PM
  5. [SOLVED] Dynamic ListBox Row Source
    By grazian2 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-31-2013, 02:04 PM
  6. Listbox to Listbox, no duplicates & submitting same UserForm data for each Listbox entry.
    By jamieswift1977 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-18-2012, 12:18 PM
  7. ListBox external source
    By DoctorG in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-21-2006, 03:00 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