Hi,
I need help to filter multiple columns for two words at the same time. I have added and example. Here are the info:
There is a heading on row 1 and 2, and other information on in column A to F. The columns that I want to filter is between G and N and rows down is undefined. Columns after S is empty.
Here is a table to use as an example:
I want to filter all the rows containing "RND" or "Sold" or both in columns G to N, and hide the rows not containing "RND" and "Sold".
I previously recieved this macro code from @Peter_SSs which worked well (ref: Filter multiple columns for a single word) but I can't figure out how to use it for multiple words:
Thank you, in advance!
I need help to filter multiple columns for two words at the same time. I have added and example. Here are the info:
There is a heading on row 1 and 2, and other information on in column A to F. The columns that I want to filter is between G and N and rows down is undefined. Columns after S is empty.
Here is a table to use as an example:
Name | Company | Notes | Notes2 | Notes3 | Notes4 | Notes5 | Notes6 | Notes7 | Notes8 |
Mike | Sky | Sold | Sold | RND | RND | RND | RND | RND | RND |
John | Glow | Sold | RND | Sold | Sold | Bought | Bought | RND | Sold |
Charles | Link | Bought | Bought | Bought | Bought | TBN | TBN | TBN | Bought |
Karen | Hero | RND | Sold | Bought | Bought | Bought | Bought | Bought | Sold |
Dennis | Letgo | TBN | TBN | TBN | Bought | Bought | Bought | Bought | TBN |
Angela | Greatso | Bought | Sold | Bought | Bought | Bought | Bought | Sold | Bought |
Paul | Marshmellow | Sold | Bought | Sold | Sold | Sold | Sold | RND | RND |
I want to filter all the rows containing "RND" or "Sold" or both in columns G to N, and hide the rows not containing "RND" and "Sold".
I previously recieved this macro code from @Peter_SSs which worked well (ref: Filter multiple columns for a single word) but I can't figure out how to use it for multiple words:
VBA Code:
Sub Show_My_Rows_of_Interest()
Dim rCrit As Range
Const TextOfInterest As String = "RND"
Const ColsOfInterest As String = "F:N"
Application.ScreenUpdating = False
Application.DisplayAlerts = False
With ActiveSheet
On Error Resume Next
.ShowAllData
On Error GoTo 0
Set rCrit = .Range("Z1:Z2")
With Intersect(.UsedRange, .Columns(ColsOfInterest))
rCrit.Cells(2).Formula = Replace(Replace("=COUNTIF(#,""*%*"")", "#", .Rows(2).Address(0, 0)), "%", TextOfInterest)
.AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=rCrit, Unique:=False
End With
rCrit.Cells(2).ClearContents
End With
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
Thank you, in advance!