Results 1 to 2 of 2
Thread: Add items to Listbox (Excel2000)
2007-04-23, 14:43 #1
- Join Date
- Nov 2001
- Atlanta, Georgia, USA
- Thanked 0 Times in 0 Posts
Add items to Listbox (Excel2000)
I'm using this code to populate a listbox with data from another sheet.
Is there a way to add a button the the form to let the user add an item that isn't in the list?
Dim lbtarget As MSForms.ListBox
Dim rngSource As Range
'Set reference to the range of data to be filled
Set rngSource = Worksheets("ModelData").Range(Worksheets("ModelDat a").Range("A1"), _
'Fill the listbox
Set lbtarget = UserForm1.ListBox1
'Determine number of columns
.ColumnCount = 4
'Set column widths
.ColumnWidths = "45;60;60;50"
'Insert the range of data supplied
.List = rngSource.Cells.Value
' Show the UserForm
2007-04-23, 14:53 #2
- Join Date
- Mar 2002
- Thanked 29 Times in 29 Posts
Re: Add items to Listbox (Excel2000)
You'd have to let the user provide 4 values, since your list box has 4 columns, then enter these values in the first empty row below the current data in the ModelData sheet, and set the List property of the list box again. Or use the AddItem method to add the item for the first column, then use Column to set the other three columns.