Keyword search - Highlight Results - Hide other rows

vundk

New Member
Joined
Jul 19, 2017
Messages
1
Dear Excel Experts

I adapted a conditional formatting Macro for my purposes. It works now with an inputbox quite neatly and highlights the cells where the keyword is found.
However, I want to hide the other rows where the keyword isn't in. I don't know if that's even possible with this code... see below

Dictionary for my german words

Abfrage... query
suche... search
Schlüsselwort... keyword
Schlagwort... keyword

Thanks for helping a beginner out

Code:
Sub Abfrage()
    Dim sucheString As String
    
    ActiveWindow.Panes(1).Activate
    Range("Tabelle1[[Schlagwort 1]:[Schlagwort 6]]").Select
    sucheString = InputBox("Schlüsselwort?")
    Selection.FormatConditions.Add Type:=xlTextString, String:=sucheString, TextOperator:=xlContains
    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    With Selection.FormatConditions(1).Font
        .Color = -16383844
        .TintAndShade = 0
    End With
    With Selection.FormatConditions(1).Interior
        .PatternColorIndex = xlAutomatic
        .Color = 13551615
        .TintAndShade = 0
    End With
  
    Selection.FormatConditions(1).StopIfTrue = False
End Sub
 

Some videos you may like

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Watch MrExcel Video

Forum statistics

Threads
1,123,312
Messages
5,600,887
Members
414,414
Latest member
neil_c

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
Top