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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
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,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

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