I use code below to populate my combobox on my excel worksheet...
Now I want to put the same into the separate class as function and call the same every time I want to load my combobox. Furthermore, reason for doing this is to also be able to use same function to load other comboboxes with same items embeded on different worksheets or userforms as well in workbook.
My issue here is how to return multiple values form the function and I would appreciate your help in order to guide me in order to mofify my VBA code in order to make this working....
Me.ComboBox1.Text = "Select date..."
rst.Open ("SELECT DISTINCT Date as ph_3 FROM BI_A_CMIV_SEG where date>= '2011-01-01' order by date desc"), cnn
x = rst.RecordCount
For i = -1 To x
While rst.EOF = False
user = rst!ph_3
Me.ComboBox1.AddItem user, 0