HELP - NEED "FIND" MACRO


Posted by EDDIE G on October 05, 2001 2:27 PM

I have a very long but simple telephone list with names in Column A and phone numbers in column B. I need a macro that will use an input box to search and find names. I don't want to use the standard find command on the tool bar. Can Someone help me?

Posted by Henry Root on October 05, 2001 9:12 PM


Check whether this is what you need (might not be) :-

Dim lookFor As Variant, rng As Range
showInputBox:
lookFor = Application.InputBox("Enter a name")
If lookFor = False Then
Exit Sub
ElseIf lookFor = "" Then GoTo showInputBox
Else: Set rng = Worksheets("Sheet1").Columns(1).Find(lookFor)
If rng Is Nothing Then
MsgBox lookFor & " was not found in column A."
Exit Sub
End If
MsgBox "The name you entered is in cell " & rng.Address(False, False)
rng.Select
End If




Posted by EDDIE G on October 06, 2001 6:31 AM

THANKS.