How can i use the same Listbox to make selections for several cells?

AJOSC

New Member
Joined
May 9, 2018
Messages
2
Hello

I have created a Listbox which allows me to make multiple selections. I then have inserted a shape to use as a button - when clicked, this writes multiple selections from the Listbox into a single cell.

I have a sheet with multiple rows and I want to go through the same process for each row - i.e. making multiple selections (from the same list of data) and writing it to a single cell (in the next row).

Does anyone have any ideas how to do this? Do I have to recreate the same listbox and button for every row? Conceptually, I just want one multi-selection list which I can then use for all cells in the same column.

BTW - I know very little about VBA so simple explanations would be very welcome!

Thanks
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Try something similar to this for Results in column "A":-
Code:
Sub Rectangle1_Click()
Dim n As Long, Lst As Long, nStr As String
 With ActiveSheet.ListBox1
    For n = 0 To .ListCount - 1
        If .Selected(n) Then
            nStr = nStr & IIf(nStr = "", .List(n), ", " & .List(n))
        End If
 Next n
If Not nStr = "" Then
    Lst = Range("A" & Rows.Count).End(xlUp).Row
    Range("A" & Lst + 1).Value = nStr
End If
End With
End Sub
 
Upvote 0
Try something similar to this for Results in column "A":-
Code:
Sub Rectangle1_Click()
Dim n As Long, Lst As Long, nStr As String
 With ActiveSheet.ListBox1
    For n = 0 To .ListCount - 1
        If .Selected(n) Then
            nStr = nStr & IIf(nStr = "", .List(n), ", " & .List(n))
        End If
 Next n
If Not nStr = "" Then
    Lst = Range("A" & Rows.Count).End(xlUp).Row
    Range("A" & Lst + 1).Value = nStr
End If
End With
End Sub
Thanks Mick
I have used that code, and it does populate multiple cells in the column. However....
It populates one cell after the next - what I am after is something that lets me select the cell I want populated (say A2) use the list box to make a selection, then jump to another cell in my register (say A20) and use the list box to make another selection?
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top