View Single Post
 
Old 11-17-2018, 05:43 PM
Logit Logit is offline Windows 10 Office 2007
Expert
 
Join Date: Jan 2017
Posts: 533
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

This will autofilter any row/s ... cell/s you select. By "cell/s" I mean, you can select a single cell in row 14 but the entire row will be filtered viewable.

Code:
Sub SelFilterRange()
Dim crit()                As Variant
Dim n                     As Long
Dim rgCell                As Range

ReDim crit(1 To Selection.Count)

n = 1
For Each rgCell In Selection.Cells
    crit(n) = CStr(rgCell.Value)
    n = n + 1
Next rgCell

ActiveSheet.Range("$A$2:$AC$476").AutoFilter Field:=1, Criteria1:=crit, Operator:=xlFilterValues
End Sub
Reply With Quote