lastEntryRow = Sheets("<sheet name>").Cells(Sheets("<sheet name>").Rows.Count, "<column letter>").End(xlUp).Row For i = 2 To lastEntryRow 'adds each row to listbox lineDisplay = Sheets("<sheet name>").Cells(i, <column you want to show in listbox>).Value & ...etc <listbox name>.AddItem lineDisplay Next
#example - reads a list of food entries from a sheet Private Sub loadListbox() lstFoods.Clear lastEntryRow = Sheets("Foods").Cells(Sheets("Foods").Rows.Count, "A").End(xlUp).Row 'how many foods are there? For i = 2 To lastEntryRow 'adds each food entry row into the listbox lineDisplay = Sheets("Foods").Cells(i, 1).Value & Chr(9) & Sheets("Foods").Cells(i, 2).Value lstFoods.AddItem lineDisplay Next End Sub
Advertisements