Sub FilterSelectedValues() ' This last one is used for filtering multiple values in a table. You paste the values you want to filter right below your table, then run the macro. Dim arrayEn() As Variant Dim selCol As Integer Dim rCell As Range Dim i As Long ReDim arrayEn(1 To 1, 1 To Selection.Count) selCol = Selection.Column i = 1 For Each rCell In Selection arrayEn(1, i) = CStr(rCell.Value2) i = i + 1 Next rCell ActiveSheet.Range("A1").AutoFilter field:=selCol, Criteria1:=arrayEn, Operator:=xlFilterValues End Sub
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter