Hello,
I need help to change the below code so that it shows 2 columns of data in the listbox as opposed to just 1 which is what it does currently. Can anyone help?
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Range("B3") = ListBox1.Value
Unload Me
Sheets("DataPivot").PivotTables("PivotTable1").PivotCache.Refresh
End Sub
Private Sub UserForm_Initialize()
Dim rRng As Range, r As Range, rSortCr As String
Set rRng = Sheet2.Range("CustomerList[cd_statement_name]")
rSortCr = UCase(Range("B3").Value)
For Each r In rRng
If InStr(UCase(r), rSortCr) Then Me.ListBox1.AddItem r.Value
Next r
If Me.ListBox1.ListCount = 1 Then
Me.ListBox1.ListIndex = 0
Range("B3") = Me.ListBox1.Value
Unload Me
Sheets("DataPivot").PivotTables("PivotTable1").PivotCache.Refresh
End If
End Sub
Bookmarks