Thread: ListBox Value
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
WhytheQ WhytheQ is offline
external usenet poster
 
Posts: 246
Default ListBox Value

On 16 Feb, 15:02, "Carrie_Loos via OfficeKB.com" <u34134@uwe wrote:
Does anybody know of a way to capture a user highlighted item out of a list
box? Is there another tool that would be more appropriate? I would like to
then take that value and do more but I am stuck on this. I can't seem to find
anything to guide me in help or the books that I have.

Thanks
Carrie

--
Message posted viahttp://www.officekb.com



Could you please copy your code into the thread.
If I have a listbox from the toolbox then the name of the listbox will
return the value.

If a sheet has a listbox (named lstbox) and a button (named cmdButton)
on it then the following should give the value of the listbox in a
message when the button is pressed:

'============================
Private Sub cmdButton_Click()
On Error Resume Next
MsgBox LstBox.value
End Sub
'============================

this will do the same, as the property value can be omitted (it being
the default property of this object):
'============================
Private Sub cmdButton_Click()
On Error Resume Next
MsgBox LstBox
End Sub
'============================

hope this helps
jason