View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Listbox Value = Null ??

But if you make the ListBox single-select only, you wouldn't need that other
button or, at worst, you would need it to clean the single selection (by
setting the ListIndex to -1).

--
Rick (MVP - Excel)


"Ryan H" wrote in message
...
I need the listbox to remain a multiselect, because I have another
commandbutton that clears all the users selected lines from the listbox.

If I pause the code I have below during execution and I type
"?lbxPreview.Value" in the Immediate Window, Null is returned. So why is
it
my message box does not show?
--
Cheers,
Ryan


"JLGWhiz" wrote:

If you make the listbox single select instead of multiselect, they can
only
select one item.


"Ryan H" wrote in message
...
I have a list box and a command button on a userform. When the command
button is clicked I want to test to ensure the user has selected only 1
item
in the listbox. I have this but it doesn't work and I don't know why,
any
ideas?

' ensure a part number is selected to edit
If lbxPreview.Value = Null Then
MsgBox "Please select a Part Number from the list to edit.",
vbCritical
Exit Sub
End If

--
Cheers,
Ryan