View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 390
Default Binding data to a ListBox without using cells

Hi Roman,

Thanks for the reply. That is kinda what I was thinking about but it's not
an exact fit. Imagine for example that I wanted to use a String as the
alternate value as opposed to an Integer e.g.

Windows XP Professional
Windows XP Home Edition
Linux v8
Linux v9
Fedora Core 3
Fedora Core 4

with index values of:
xpp
xph
l8
l9
fc3
fc4

respectively. I know that you can bind ListBoxes to a columns so that one
cell shows up in the ListBox and another is returned as the Selected ListBox
value. My dilemma is achieving the same results but without actually using
any cells i.e. a memory structure. It doesn't look like that is possible
though.

Cheers, Max

"Roman" wrote:

Hi Max
use this to feed the form:

Sub feedtheform()
mylist = Array("red", "orange", "green")
UserForm1.ComboBox1.List = mylist
UserForm1.Show
End Sub

and this to get your value

Private Sub ComboBox1_Change()
dim myvalue as integer
myvalue = UserForm1.ComboBox1.ListIndex + 1
MsgBox myvalue
End Sub

Hope this helps.