|
Tutorials
|
|
In a VBA Listbox it is possible to add multiple columns. Code below shows a sample of how to add three columns to a listbox.
Show/Hidden vbnet code Sub AddMultipleColumn()
'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.List(0, 1) = "Column Number 2" 'List(x,y) X is the row number, Y the column number
ListBox1.List(0, 2) = "Column Number 3"
ListBox1.List(0, 3) = "Column Number 4"
ListBox1.AddItem "Row Number 2"
ListBox1.List(1, 1) = "Column Number 2"
ListBox1.List(1, 2) = "Column Number 3"
ListBox1.List(1, 3) = "Column Number 4"
ListBox1.AddItem "Row Number 3"
ListBox1.List(2, 1) = "Column Number 2"
ListBox1.List(2, 2) = "Column Number 3"
ListBox1.List(2, 3) = "Column Number 4"
End Sub
Result is shown below:
Attachments:
| File | Description | File size | Downloads |
MultipleColumnListbox | Create a Multiple Column Listbox | 24 Kb | 1191 |
|
Comments
Nice Article. Wondering why the same code doesn't work in Outlook 2010?
Hope someone there can let me know
Regards
RSS feed for comments to this post.