Hector
08-21-2015, 04:57 PM
Hello guys.
In the code below, I am getting data (comma separated) from Range AO21, which would be the criteria to search for in a filter.
Lets say, Range AO21 value is "APPLES, GRAPES, ORANGES".
The code below will only search for apples and grapes, which are the first 2 words comma separated in range AO21. I need a code to let me have several comma separated values to filter, no matter how many.
Dim FRUITS As String
Dim Data As Variant
INVOICE_WORKBOOK.Activate
Range("AO21").Select
FRUITS = ActiveCell.Value
PIVOT_WORKBOOK.Activate
If InStr(1, FRUITS, ",") > 0 Then
Data = Split(FRUITS, ",")
Range("A1").AutoFilter Field:=1, Criteria1:=Trim(Data(0)), Operator:=xlOr, Criteria2:=Trim(Data(1))
Else
Range("A1").AutoFilter Field:=1, Criteria1:=FRUITS
End If
if anybody could take a minute to help me, I would be really appreciated.
Hector
In the code below, I am getting data (comma separated) from Range AO21, which would be the criteria to search for in a filter.
Lets say, Range AO21 value is "APPLES, GRAPES, ORANGES".
The code below will only search for apples and grapes, which are the first 2 words comma separated in range AO21. I need a code to let me have several comma separated values to filter, no matter how many.
Dim FRUITS As String
Dim Data As Variant
INVOICE_WORKBOOK.Activate
Range("AO21").Select
FRUITS = ActiveCell.Value
PIVOT_WORKBOOK.Activate
If InStr(1, FRUITS, ",") > 0 Then
Data = Split(FRUITS, ",")
Range("A1").AutoFilter Field:=1, Criteria1:=Trim(Data(0)), Operator:=xlOr, Criteria2:=Trim(Data(1))
Else
Range("A1").AutoFilter Field:=1, Criteria1:=FRUITS
End If
if anybody could take a minute to help me, I would be really appreciated.
Hector