• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Unselect in listbox

Belleke

Well-Known Member
I have a listbox, see code but afther the selection I would like that there is no more selection in the listbox
Code:
Private Sub ListBox1_Click()
With ListBox1
    If .ListIndex > -1 Then
          TextBox1.Value = .List(.ListIndex, 0)
         
    End If
End With

With ActiveCell
    If .Column = 1 Then .Value = Me.TextBox1.Value
    If .Column = 2 Then .Value = Me.TextBox1.Value
    If .Column = 4 Then .Value = Me.TextBox1.Value
End With

End Sub
Somewhere afther End with i need a bit of code that clears the selection not the listbox
Please advice
 
Thank you for youre reply, I tryed that
Included file,
It is about userform 4, if you select somethhing in the Listbox I want to select it again without clicking on an other item an then go back to the first choice
 

Attachments

  • WARMTEVERLIES ISSO 51 dotchiejack 15-8-2016.xlsb
    167.3 KB · Views: 12
There you go,
You can use a command button into your userform uder your list box and add the code below

TESTED

Code:
Private Sub CommandButton1_Click()
Dim i As Long
For i = 0 To ListBox1.ListCount - 1
    ListBox1.Selected(i) = Not ListBox1.Selected(i)
Next

End Sub

Hope this help :)
-K-
 

Attachments

  • WARMTEVERLIES ISSO 51 dotchiejack 15-8-2016 (1).xlsb
    166.9 KB · Views: 12
Thank you for youre reply, but this is not what I need.
If i click on a item in listbox then macro and afther the macro clear the selection in Listbox so I can click the same item again (select it again)
 
I am afraid I don't understand what you looking for,

In addition the file you sent is in a different language and I am having a hard time deciphering your needs...

If you can please provide detailed description of what you looking for so that we can assist you accordingly.:)

-K-
 
Hello,
Thank you for youre time and efford, I'll try to explain it better.
When I click in de listbox on a artikel (lets say artikel a) then the code runs and the artikel gets blue in the listbox. If I want the same artikel again(artikel a)I first have to click on another artikel (artikel b) and then click on artikel a again. What I want is a bit of code to renew the listbox so that I can click the artikel a multiple times without going to artikel b first.
Tank you
 
Hello Kmahraz,
I found the solution
Code:
Private Sub ListBox1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
ListBox1.Selected(ListBox1.ListIndex) = False
End Sub
Thank you for youre time and efford
problem solved
 
Back
Top