Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Listbox - First item in list "default"
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 -- HJN |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Listbox - First item in list "default"
Make the .Listindex = 0
"Hennie Neuhoff" wrote in message ... 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 -- HJN |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Data Validation - List - with "Add Item..." | Excel Discussion (Misc queries) | |||
Listbox header inside VBA (Array("Head1", "Head2", ...) | Excel Programming | |||
Make typing "jump" to matching item(s) in drop-down list? | Excel Discussion (Misc queries) | |||
Listbox "expand range as list grows" | Excel Programming | |||
ListBox "picking the same item repeatedly" | Excel Programming |