Code:
Private Sub cmdOK_Click()
Dim lname As String
For i = 0 To lstDV.ListCount - 1
If lstDV.Selected(i) = True Then
lname = lname & lstDV.List(i, 0) & ","
End If
Next
lname = Left(lname, Len(lname) - 1)
LeagueNames = lname
Set fltData = Sheet1.Range(Sheet1.Range("A1"), Sheet1.Range("T2").End(xlDown))
With fltData
.AutoFilter Field:=10, Criteria1:=Array(lname), Operator:=xlAnd
End With
Me.Hide
End Sub
If I select only one value for lname, the filter works fine, but if I select more than one, the filter does not work, I get 0 values. Any idea what should I fix?