Here is a sample code for the list box
This code is running outside any of the office applications like Word or Excel
Code: Select all
Private Sub UserForm_Initialize()
'Add multiple Columns to a listbox
ListBox1.Clear 'Make sure the Listbox is empty
ListBox1.ColumnCount = 3 'Set the column Amount
'Fill the Listbox
ListBox1.AddItem "Row Number 1" 'Additem creates a new row
ListBox1.AddItem "Row Number 2"
ListBox1.AddItem "Row Number 3"
ListBox1.List(0, 1) = "Column 2 Row 1" 'List(x,y) X is the row number, Y the column number
ListBox1.List(0, 2) = "Column 3 Row 1"
ListBox1.List(2, 1) = "Column 2 Row 3"
ListBox1.List(2, 2) = "Column 3 Row 3"
ListBox1.List(1, 1) = "Column 2 Row 2"
ListBox1.List(1, 2) = "Column 3 Row 2"
End Sub