I want a macro to filter a sheet for all instances of our corporate email address regardless of which column they are in (50+ columns). I have tried Autofilter and AdvancedFilter without success. AdvancedFilter seems most likely, but I cannot find examples of the syntax for CriteriaRange.
I have read <>text can be used for wildcards, but have no idea how to use it.
The worksheet has the column headers in rows 10-11 (not my sheet, so I cannot change it).
My most recent attempt gives an Expected expression error:
Sub AdvancedFilter()
If Sheets(2).FilterMode = True Then
Sheets(2).ShowAllData
End If
Sheets(2).Range("A13:CO100").AdvancedFilter _
Action:=xlFilterInPlace, _
CriteriaRange:=(*mydomain.com)
End Sub
Please, try the next way. It should be very fast, hiding the rows not containing the searched domain: