Populate Combobox from table column

gyster

New member
Joined
Aug 9, 2016
Messages
11
Reaction score
0
Points
0
Hello. I have userform with a combobox that I'd like to have populate with data from a table column in Excel. I would like to have the combobox populated when I initialize the form from column A in my table. Can anyone help with a construct for this?

Help is appreciated.
 
If you're using a real Excel table, an adaptation of this should work.
Code:
Me.ComboBox1.List = ActiveSheet.ListObjects("Table1").ListColumns(1).DataBodyRange.Value

If what you're referring to as a table is a standard range use something along the lines of this
Code:
Me.ComboBox1.List = ActiveSheet.Range("A2:A10").Value


for everything you'd ever want to know about loading combo boxes see this at snb's site

for a little insight into Tables check out http://www.thespreadsheetguru.com/blog/2014/6/20/the-vba-guide-to-listobject-excel-tables


 
Thanks NoS. It's actually a table, I had part of the code, but didn't have DataBodyRange.Value...kind of important. :) That solves the problem though, so thanks again!
 
Back
Top