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?
Function UserForm1_Initialize() 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("ModelData").Range("A1"), _ Worksheets("ModelData").Range("D1").End(xlDown)) 'Fill the listbox Set lbtarget = UserForm1.ListBox1 With lbtarget 'Determine number of columns .ColumnCount = 4 'Set column widths .ColumnWidths = "45;60;60;50" 'Insert the range of data supplied .List = rngSource.Cells.Value End With ' Show the UserForm UserForm1.Show End Function
Thanks,
Scott