Link to List Box Entries?

  • Thread starter Thread starter documike
  • Start date Start date
No.

But maybe you could use some code to populate a range.

I put a listbox from the Forms toolbar on a worksheet. I added a button from
that same Forms toolbar.

I assigned the input range of the listbox to A1:A25. Then I assigned this macro
to that adjacent button:

Option Explicit
Sub testme()

Dim myRng As Range
Dim iCtr As Long
Dim jCtr As Long
Dim myListBox As ListBox

With Worksheets("sheet1")
Set myListBox = .ListBoxes("list box 1")
'make enough room for all the possible selections
Set myRng = .Range("b1").Resize(myListBox.ListCount)
myRng.ClearContents
jCtr = 1
For iCtr = 1 To myListBox.ListCount
If myListBox.Selected(iCtr) Then
myRng.Cells(jCtr, 1).Value = myListBox.List(iCtr)
'clear selection???
myListBox.Selected(iCtr) = False
jCtr = jCtr + 1
End If
Next iCtr
End With

End Sub
 
Back
Top