View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Listbox Initial Values

To return the last item in the list box.

y = UserForm1.ListBox1.Selected(ListBox1.Rows.Count -1)
MsgBox y

ListBox row index begins with zero, so the last item index number will be
one less that the number of rows.


"Marvin Buzz" wrote:

I have two listbox controls named FROM and TO
The rowsource for both is the same, but variable in length. When the user
form loads, I would like to have FROM display and select the first value in
the rowsource, and to have TO display and select the last value in the
rowsource. Using TOPINDEX causes the correct value to be displayed, but the
returned value is null.

Any suggestions please?

Thanks.

Marvin