So I have a form that simplifies the process of entering in systematic information. The form consists of 3 listboxes, a textbox and a few buttons. It works fine if the user clicks on each listbox, and then on the "OK" button.
I also want to provide a radiobutton that pre-populates each control (there's basically one combination that's popular, so the radiobutton saves time and maximizes consistency). All the controls get properly selected..... but I can only get values from 2 of the listboxes... one of them only gets a value if a user CLICKS on it... otherwise it keeps value=""
No multi-select issues or complex stuff... this should be super simple... What gives?
Probably easiest to understand if you look at the file HERE: bug.xls
CODE BELOW:
Option Explicit
Private Sub CommandButton1_Click()
ActiveCell.Value = _
Left(Me.ListBox1.Value, 1) & _
Left(Me.ListBox3.Value, 1) & _
Left(Me.ListBox2.Value, 1) & "|" & _
Me.TextBox1.Value
Unload Me
End Sub
Private Sub OptionButton1_Click()
Me.ListBox1.ListIndex = 2
Me.ListBox2.ListIndex = 0
Me.ListBox3.ListIndex = 1
Me.TextBox1.Value = "TEST"
Me.CommandButton1.SetFocus
End Sub
Private Sub userform_activate()
With Me.ListBox1
.AddItem "A1"
.AddItem "B2"
.AddItem "C3"
End With
With Me.ListBox2
.AddItem "Y"
.AddItem "N"
End With
With Me.ListBox3
.AddItem "1 "
.AddItem "2 "
.AddItem "3 "
End With
End Sub
Bookmarks