filters rows cantaining a certain word

XiniX

Board Regular
Joined
May 1, 2002
Messages
57
I got a list of proverbs and i want to see only those proverbs containing a certain word. How can i make a filter which will do that?

Thank you...
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Sub Autofilter()
'
' Macro1 Macro
' Macro recorded 18/10/2002 by Roy Cox
'

'
Selection.Autofilter
ActiveWindow.ScrollColumn = 1
Selection.Autofilter Field:=1, Criteria1:="Your Word"
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3

End Sub

This might work.
 
Upvote 0
for a non-macro based approach, you can also try putting this formula in the column next to your column of proverbs:

=1-ISERROR(FIND("slings and arrows",A1))

Then you can filter on that column.
 
Upvote 0
Thank you, so fast an answer..

I want "Your word" put dynamically in the macro. So that the macro askes for the word to filter...

Is that possible?
 
Upvote 0
On 2002-10-27 09:00, XiniX wrote:
Thank you, so fast an answer..

I want "Your word" put dynamically in the macro. So that the macro askes for the word to filter...

Is that possible?

Hi,

Maybe you can use this macro.
It will show only the rows that contain a specified word.
<pre>
Sub Filter()
Dim searchString As String
Dim found As Range
Dim unionRng As Range

'get string to search
searchString = InputBox("Filter what?", "Filter", "")
If searchString = "" Then Exit Sub

' remove any filters
ActiveSheet.AutoFilterMode = False
' unhide all
saveCellPos = ActiveCell.Address
Cells.Select
Selection.EntireRow.Hidden = False

Set found = Cells.Find(searchString)
If Not found Is Nothing Then
FirstAddress = found.Address
Set unionRng = found
Do
Set found = Cells.FindNext(After:=found)
If found.Address = FirstAddress Then Exit Do
Set unionRng = union(found, unionRng)
Loop

'show only 'rows' containing searchstring
Cells.Select
Selection.EntireRow.Hidden = True
unionRng.EntireRow.Hidden = False
Else
MsgBox searchString & " not found!"
End If
Range(saveCellPos).Select
Set unionRng = Nothing
Set found = Nothing
End Sub
</pre>
 
Upvote 0

Forum statistics

Threads
1,214,945
Messages
6,122,393
Members
449,081
Latest member
JAMES KECULAH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top