Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 07-18-2017, 05:28 PM
eduzs eduzs is offline Populate listbox Windows 10 Populate listbox Office 2010 32bit
Expert
Populate listbox
 
Join Date: May 2017
Posts: 266
eduzs is on a distinguished road
Default

Thanks, I found that:

To populate a two column listbox:

With UserForm.LB1
.ColumnCount = 2
.ColumnWidths = "6;6"
.AddItem "1"
.List(0, 0) = "Name1"
.List(0, 1) = "E-mail1"
.AddItem "2"
.List(1, 0) = "Name2"
.List(1, 1) = "E-mail2"
.ListIndex = 1 ' Sets the default value
End With

To retrieve: First Column: UserForm.LB1.Column(0, .LB1.ListIndex) Second column: UserForm.LB1.Column(1, .LB1.ListIndex)

To populate a single column listbox:

With UserForm.LB1
.AddItem "Name1"
.AddItem "Name2"
.ListIndex = 1
End with

To retrieve: UserForm.LB1.List(.LB1.ListIndex)
__________________
Backup your original file before doing any modification.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate listbox Excel ListBox koreggan Excel 1 04-23-2016 11:44 PM
Populate listbox ListBox with multiple columns Kaatje Word VBA 2 02-27-2016 09:37 AM
This is a Userform LIstbox queston: A variable does not set to the value of a listbox CatMan Excel Programming 14 08-18-2014 08:14 PM
Populate listbox This is a Userform LIstbox queston: A variable does not set to the value of a listbox CatMan Excel 1 08-08-2014 09:41 AM
as the return value of another column, using Listbox? marreco Excel Programming 1 03-27-2012 12:48 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:18 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft