Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multiselect Listbox - identify if item picked
Hello the next conundrum i have in relation to my ongoing userform development. basically i want to confirm that at least one item has been selected from my listbox before allowing my commandbutton to proceed. help!! (this part i can do) in the event that nothing has been selected i want to exit sub and prompt user to pick a item from the listbox - so it's just the first bit that has me stumped. i can't use listindex because of the multiselect function. regards darren -- apndas ------------------------------------------------------------------------ apndas's Profile: http://www.excelforum.com/member.php...o&userid=36137 View this thread: http://www.excelforum.com/showthread...hreadid=564556 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multiselect Listbox - identify if item picked
Seems like you have to use the _Change event instead of the _Click events to
detect a click, in Excel2K; seems bizarre as you are clicking without changing anything.. but anyway. Private Sub ListBox1_Change() Dim i As Long With ListBox1 For i = 0 To .ListCount - 1 If .Selected(i) = True Then CommandButton1.Enabled = True Exit Sub End If Next End With CommandButton1.Enabled = False End Sub NickHK "apndas" wrote in message ... Hello the next conundrum i have in relation to my ongoing userform development. basically i want to confirm that at least one item has been selected from my listbox before allowing my commandbutton to proceed. help!! (this part i can do) in the event that nothing has been selected i want to exit sub and prompt user to pick a item from the listbox - so it's just the first bit that has me stumped. i can't use listindex because of the multiselect function. regards darren -- apndas ------------------------------------------------------------------------ apndas's Profile: http://www.excelforum.com/member.php...o&userid=36137 View this thread: http://www.excelforum.com/showthread...hreadid=564556 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multiselect Listbox - identify if item picked
Thanks for your reply Nick - that sub works however in disabling the command button it does not allow me to then select a manifest # and continue processing my invoice, I just want it to alert me that nothing has been selected and setfocus on the manifest list and be then able to select something - that sounds a bit circular - I hope I'm making some sense. regards Darren -- apndas ------------------------------------------------------------------------ apndas's Profile: http://www.excelforum.com/member.php...o&userid=36137 View this thread: http://www.excelforum.com/showthread...hreadid=564556 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multiselect Listbox - identify if item picked
You mean something like this ?
Private Sub ListBox1_Change() Dim i As Long With ListBox1 For i = 0 To .ListCount - 1 If .Selected(i) = True Then 'Do nothing Exit Sub End If Next End With MsgBox "Missing some selection" ListManifest.SetFocus End Sub NickHK "apndas" ¼¶¼g©ó¶l¥ó·s»D:apndas.2bk3jg_1153923607.6654@excel forum-nospam.com... Thanks for your reply Nick - that sub works however in disabling the command button it does not allow me to then select a manifest # and continue processing my invoice, I just want it to alert me that nothing has been selected and setfocus on the manifest list and be then able to select something - that sounds a bit circular - I hope I'm making some sense. regards Darren -- apndas ------------------------------------------------------------------------ apndas's Profile: http://www.excelforum.com/member.php...o&userid=36137 View this thread: http://www.excelforum.com/showthread...hreadid=564556 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multiselect Listbox - identify if item picked
Hi Nick Unfortunately that does not work, if I don't select anything in the listbox (1 or more items) it still processes the invoice when i click the commandbutton, i think the test needs to be in the commandbutton_click code, which i also tried but could still not get it to work???? aagghh!!! -- apndas ------------------------------------------------------------------------ apndas's Profile: http://www.excelforum.com/member.php...o&userid=36137 View this thread: http://www.excelforum.com/showthread...hreadid=564556 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multiselect Listbox - identify if item picked
You have the code to test if you have any selection or not, so it's up to
you decide when it is called. NickHK "apndas" wrote in message ... Hi Nick Unfortunately that does not work, if I don't select anything in the listbox (1 or more items) it still processes the invoice when i click the commandbutton, i think the test needs to be in the commandbutton_click code, which i also tried but could still not get it to work???? aagghh!!! -- apndas ------------------------------------------------------------------------ apndas's Profile: http://www.excelforum.com/member.php...o&userid=36137 View this thread: http://www.excelforum.com/showthread...hreadid=564556 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Setting up a list where an item can only be picked once in Excel | Excel Worksheet Functions | |||
Multiselect Listbox use | Excel Discussion (Misc queries) | |||
If certain item is picked, then text added... | Excel Discussion (Misc queries) | |||
Bug in multiselect listbox? | Excel Programming | |||
Multiselect Listbox | Excel Programming |