I made this macro by recording it:
Sub TEST1()
'
Sheets("Data from SAP filter").Select
ActiveSheet.Range("$A$1:$Z$5000").AutoFilter Field:=21, Criteria1:=Array("5000165", "5000746", "5000831", "5000882"), Operator:= _
xlFilterValues
End Sub
The string in the Array should be substituted by the value in H5 in a different sheet in the same workbook
H5 = "5000165", "5000746", "5000831", "5000882", "5001059"
So I tried this:
Sub TEST2()
Sheets("EP Macro Create").Select
Dim CellValue As Variant
CellValue = Range("H5").Value
Sheets("Data from SAP filter").Select
ActiveSheet.Range("$A$1:$Z$5000").AutoFilter Field:=21, Criteria1:=Array(CellValue), Operator:=xlFilterValues
MsgBox CellValue
End Sub
The MsgBox return the value in cell H5, but the filter returns no values at all.
Is it possible to do this another way ?
Tried to change the text string in cell H5 and making it semicolon delimited, did not help ?
Also tried to change the text string in cell H5 so it looked like this: 5000165, 5000746, 5000831, 5000882, 5001059, still same result
Bookmarks