Re: Last Selection from MultiSelect Listbox

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Jim,

Sorry, but I must not have expained it correctly...

I'm not looking for the last item in the listbox that is selected.... I'm
looking for the last item actually selected (order of selection). And to
take it further... if something is deselected, I would like to refer back to
the previous item selected.

It might be easier for me to carry two single select listboxes with add> and
<remove buttons to control the "selected" list. If I don't sort the "Add
to" listbox... then the last item in that listbox is always the last item
selected (based on order).

But I thought that there might be a special function that would give me the
last item in the listbox that was selected.

Appreciate the post though.

Brian



"Jim Cone" <jim.coneXXX@xxxxxxxxxx> wrote in message
news:O64xLR89FHA.1444@xxxxxxxxxxxxxxxxxxxxxxx
> Brian,
> '-----------------------------
> Private Sub CommandButton2_Click()
> Dim N As Long
> Dim lngItem As Long
> For N = 0 To ListBox1.ListCount - 1
> If ListBox1.Selected(N) = True Then
> lngItem = N
> End If
> Next 'N
> If lngItem > 0 Then
> MsgBox "Last item selected is " & ListBox1.List(lngItem, 0)
> Else
> MsgBox "Nothing selected "
> End If
> End Sub
> '------------------------------
> Jim Cone
> San Francisco, USA
>
>
> "Brian" <bkstigler@xxxxxxx> wrote in message
> news:%23aEz%23u59FHA.3292@xxxxxxxxxxxxxxxxxxxx
> Is there an easy way to identify the last item selected in a multiselect
> listbox?
> The MultiSelect property for the listbox I'm using is "MultiSelectMulti"
> with a "liststyleOption".
> Thanks,
> Brian
>
>


.


Quantcast