I wanted to do an auto filter based on cell value, I got the code to work for the most part but I still stuck on 2 things
- I want it to be a partial match (currently it is full match)
- I want it to be none case sensitive (currently it is case sensitive) How do I modify the code?
Q2 in the code refer to column header and Q3 refer to the actual value (name) Thank you in advance for your help!
Sub Filter()
Dim FNameVal As String
Dim cell As Range
With Sheets("Database")
FNameVal = .Range("Q3").Value2
For Each cell In .Range("B6:U1000").Cells
If FNameVal = cell.Value2 Then
Range("B6:U1000").CurrentRegion.AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range("Q2:Q3")
Exit For
End If
Next
End With
End Sub