The file attached is a sample one. I didn;t create a drop down in it. I put the output of the drop down selection on Sheet3 as I would need the pivot to be filtered on this output. Here's the code that is getting the selection from the listbox and dumping it on the separate worksheet. output is the name of the worksheet that the products are being dumped in.
Private Sub ListBox1_LostFocus()
Dim listItems As String, i As Long
With ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then listItems = listItems & .List(i) & ", "
Next i
End With
If Len(listItems) > 0 Then
Sheets("output").Range("J1") = Left(listItems, Len(listItems) - 2)
Else
Sheets("output").Range("J1") = ""
End If
Range("BE2:BE100").ClearContents
SplitAll
End Sub
Sub SplitAll()
Dim src As Range
Dim result As Variant
For Each src In Sheets("output").Range("J:J").SpecialCells(xlCellTypeConstants)
result = Split(src, ",")
'last cell in column C
With Cells(1, 57).End(xlUp)
Range(.Offset(1, 0), .Offset(1 + UBound(result, 1), 0)) = Application.WorksheetFunction.Transpose(result)
End With
Next src
End Sub
thanks for the reading material. will go through it now.