ListBox

  • Thread starter Thread starter Gordon
  • Start date Start date
G

Gordon

Can not get value from listBox to Variable.
My code: ListBox1 -> RowSource = A:A
UserForm_Activate() -> ListBox1.RowSource = "A1:A" & N (# of names in
Col,A1)
This part works, but can't get user selection to Variable. Need help

Thanks,
GJ
 
Dim myVar as string
with me.listbox1
if .listindex = -1 then
'nothing chosen
myvar = "Make a choice" '????
else
myvar = .value
end if
end with

may work.
 
For Counter = 0 to Listbox1.ListCount - 1
If Listbox1.Selected(Counter) Then
MsgBox Listbox1.List(Counter)
End If
Next


--
Jim
| Can not get value from listBox to Variable.
| My code: ListBox1 -> RowSource = A:A
| UserForm_Activate() -> ListBox1.RowSource = "A1:A" & N (# of names in
| Col,A1)
| This part works, but can't get user selection to Variable. Need help
|
| Thanks,
| GJ
|
 
Back
Top