MrExcel Publishing
Your One Stop for Excel Tips & Solutions

VBA and Search


Posted by Paul on January 28, 2002 8:34 AM

How can iu use VBA to search the active document for a value i enter into a dialog box?


Posted by Dan Aragon on January 28, 2002 10:11 AM

Here is a sample that you can use to get you started. Reply back if you have any questions.

Sub FindString()
Dim UserInput As String
UserInput = InputBox("Enter String")
Cells.Find(What:=UserInput, After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False) _
.Activate
End Sub