Dynamic Listbox?

dave8

Active Member
Joined
Jul 8, 2007
Messages
275
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?
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
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
 
Upvote 0
How are you adding the data and how when you want the list updated?

Also, how are you currently populating it?
 
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0
Private Sub UserForm_Click()
ListBox1.RowSource = Range("A2:A" & Cells(1000, 1).End(xlUp).Row).Address
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,551
Messages
6,120,161
Members
448,948
Latest member
spamiki

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top