Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to show multiple value in linked cells of a Listbox?

Status
Not open for further replies.

feipezi

IS-IT--Management
Aug 10, 2006
316
US
Hi,
I tried to simulate a Pivottable's Row or Column fields by a Listbox with fmMultiSelectMulti (=1). But LinkedCell only works with single selection of a Listbox, not multiple.
The following Sub can put multi selected values in more than one cell but it must be called before it does it.
What I expected is to show the values selected in "LinkedCells" without calling some macros or pressing a button, like what an Event does: Worksheet_Change(). But I cannot use that event since I have quite a few Shapes on the sheet and I don't want any interaction among them.
Thanks in advance.

Sub ListBoxTest()
Dim lItem As Long
Range("ip1:ip10").Clear
For lItem = 0 To ActiveSheet.ChannelListBox.ListCount - 1
If ActiveSheet.ChannelListBox.Selected(lItem) = True Then
Sheets("TEST").Range("ip65536").End(xlUp)(2, 1) = ActiveSheet.ChannelListBox.List(lItem)
ActiveSheet.ChannelListBox.Selected(lItem) = False
End If
Next
End Sub
 
Hi again,
I'm sorry but I found Private Sub Listbox1_Change can give me what I need.
Now my question is how to UNSELECT the items selected in the box. If I use the code above, ActiveSheet.ChannelListBox.Selected(lItem) = False
the values selected in the designated cells will be gone.
Hope I made myself understood.
Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top