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
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