search word or text in excel spreadsheet

L

Louis

Hello

Could somebody help me.

how could i find in the colomn A with an input box one word or sentence
writen in the input box.

Thanks for your help

Louis
 
G

Gary''s Student

Try this:

Sub louis()
Dim s As String
Set r = Intersect(Range("A:A"), ActiveSheet.UsedRange)
Set r2 = Nothing
s = Application.InputBox(prompt:="enter string:", Type:=2)
For Each rr In r
If rr.Value = Replace(rr.Value, s, "") Then
Else
If r2 Is Nothing Then
Set r2 = rr
Else
Set r2 = Union(r2, rr)
End If
End If
Next

If r2 Is Nothing Then
MsgBox ("Nothing Found")
Else
r2.Select
End If
End Sub
 
Top