View Single Post
 
Old 11-20-2019, 09:25 AM
p45cal's Avatar
p45cal p45cal is offline Windows 10 Office 2019
Expert
 
Join Date: Apr 2014
Posts: 863
p45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant future
Default

try:
Code:
Dim Blocked As Boolean 'this line should be outside the macro and at the top of the code-module.

Private Sub ListBox1_Click()
If Blocked Then Exit Sub
With Me.ListBox1
  If .ListIndex > -1 Then
  Blocked = True
    Cells(Rows.Count, "C").End(xlUp).Offset(1).Value = .Value
    .MultiSelect = fmMultiSelectMulti
   .Selected(.ListIndex) = False
    .MultiSelect = fmMultiSelectSingle
  End If
End With
Blocked = False
End Sub
This could be in the _change event instead, but not both.
Reply With Quote