Dynamic Listbox?

dave8

Active Member
Joined
Jul 8, 2007
Messages
264
I have a ListBox that references a list on SheetA1:A10. As I add data from A11....Axx, I would like the ListBox to grow and have the [new] data included in the ListBox. Something to do with changing the .RowSource property in VBA?
 

ColinKJ

Well-known Member
Joined
Jan 27, 2009
Messages
983
Hi dave8,

Is the Listbox on a Userform, or direct on a Sheet. If on the Sheet, is it permanently displayed, or is it made visible by some action.

ColinKJ
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,362
Office Version
365
Platform
Windows
How are you adding the data and how when you want the list updated?

Also, how are you currently populating it?
 

dave8

Active Member
Joined
Jul 8, 2007
Messages
264
In the ListBox property. In the RowSource, I have a reference: Sheet1!A1:A6. But if I add data, I want this to show up in the List.
 

ColinKJ

Well-known Member
Joined
Jan 27, 2009
Messages
983
Hi dave,

Can you post the code you are currently using.

ColinKJ
 

snoopyhr

Active Member
Joined
Aug 12, 2002
Messages
395
I do not know much about VBA, but if I were you I would use the combination of Data validation and offset.
Let say your list that is going to grow is in column A, and you want your picklist in C5.
First in a cell of your choice create a an offset formula as such( this optional, I always do this to see the hints to create an offset you can simply type the formula directly into the source box of the data validation):
=OFFSET(A2,,,COUNTA(A:A)-1,), the "-1" is for counting for table header, if you do not have a header then ignore -1.
then copy the formula , goto cell C5, select data validation, select list, and in the source box paste the formula. as you add names to the list the pick list gets updated accordingly.
 

tryagain

Board Regular
Joined
Mar 15, 2010
Messages
102
Private Sub UserForm_Click()
ListBox1.RowSource = Range("A2:A" & Cells(1000, 1).End(xlUp).Row).Address
End Sub
 

Forum statistics

Threads
1,082,250
Messages
5,364,020
Members
400,774
Latest member
Goldi paul

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top