Listbox - First item in list "default"

H

Hennie Neuhoff

I use a userform with a listbox. More than 50% of the time the first
option from the list will be selected by the user. I'm pretty sure I've seen
it somewhere that the first entry can be the "default" selection in which
case the user just hit enter for the selection, however I can't find it.
Any idea how this can be achieved ?

Example of userform [xl2003]
Sub KryKlaRek()
Uklarek.ListBox1.Clear
reDoCli:
Uklarek.ListBox1.RowSource = "ListClient"
Uklarek.Show
If Not bContinue Then End
With Uklarek.ListBox1
If .ListIndex = -1 Then
MsgBox "You did not select a client"
GoTo reDoCli
Exit Sub
End If
If Range("BronInlig!KlaKies").Value = 1 Then Range("broninlig!tydrek").Value
= Uklarek.ListBox1.Value
Range("broninlig!tydkla").Value = Uklarek.ListBox1.Value
End With
Unload Uklarek
Exit Sub
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top