Home Excel VB/VBA Multiple Columns in Listbox
23 | 02 | 2012
Main Menu
Search
Paypal Donation
So we can continue and expand this site
Content View Hits : 469520
Multiple Columns in Listbox PDF Print E-mail
User Rating: / 7
PoorBest 
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

View source
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:
FileDescriptionFile sizeDownloads
Download this file (SampleColumns.xls)MultipleColumnListboxCreate a Multiple Column Listbox24 Kb1191
 

Comments  

 
0 #3 Bulldog 2012-02-05 08:23
Exported the form and imported it to a 32-bit Outlook 2010 VBA project and it works fine.
Quote
 
 
0 #2 Bulldog 2012-02-05 08:23
Exported the form and imported it to a 32-bit Outlook 2010 VBA project and it works fine.
Quote
 
 
0 #1 2011-12-14 06:28
HI

Nice Article. Wondering why the same code doesn't work in Outlook 2010?

Hope someone there can let me know

Regards
Quote
 

Add comment


Security code
Refresh

Advertising

LOGON
Sponsored Links