![]() |
|
#1
|
|||
|
|||
|
Hello
I have a workbook with 2 sheets ( default names), data is stored on Sheet1 in row A ( DOG1 - DOG10), I have created a list box on Sheet2 that pulls in that information and populates the list box. I have the following code Code:
Private Sub ListBox1_Click() 'Select first empty cell in column C Cells(Rows.Count, "C").End(xlUp).Offset(1).Select 'Paste in the value from the listbox ActiveCell.Formula = ListBox1.Value End Sub |
|
#2
|
||||
|
||||
|
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
|
|
#3
|
|||
|
|||
|
works perfectly thank you so much p45cal
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Mutliple Selection List Box | tbrynard01 | Word | 0 | 09-10-2019 12:56 PM |
Multiple Selection Dropdown list
|
ajanson | Word VBA | 36 | 07-15-2019 08:16 PM |
| Multiple-Selection List in Word 2016 | jamboersma | Word | 1 | 05-24-2018 06:44 PM |
| block selection in dropdown list | Intruder | Excel | 2 | 01-10-2013 10:20 AM |
| How do you add to a selection list? | bryanarn | Excel | 2 | 03-05-2012 05:04 PM |