Hello,
Is there anyway to deselect a value in Listbox4 when clicked twice?
Hello,
Is there anyway to deselect a value in Listbox4 when clicked twice?
Try something like this....
Change ListBox1 in the following code as per the name of your ListBox.
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean) Dim i As Long For i = 0 To ListBox1.ListCount - 1 ListBox1.Selected(i) = False Next i End Sub
Regards
sktneer
Treat people the way you want to be treated. Talk to people the way you want to be talked to.
Respect is earned NOT given.
Thanks you for the code, I tried but not working in Form Control.
What is the Name of your ListBox Control?
It is List Box 4.
Then try this. The code below will deselect all the selected items in the ListBox4 after double clicking the listbox.
Private Sub ListBox4_DblClick(ByVal Cancel As MSForms.ReturnBoolean) Dim i As Long For i = 0 To ListBox1.ListCount - 1 ListBox1.Selected(i) = False Next i End Sub
For a listbox from the Forms menu, assign it to this macro
Sub ListBox1_Change() Static flag As Boolean If flag Then ActiveSheet.Shapes(Application.Caller).OLEFormat.Object.ListIndex = 0 End If flag = Not flag End Sub
_
...How to Cross-post politely...
..Wrap code by selecting the code and clicking the # or read this. Thank you.
Ah I missed that it was a form control though the OP mentioned that. My bad.
That Worked Perfect! Thanks Both of you.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks