Find Command Button

N

NeedMorHP

I want to insert a Find Command Button in a spreadsheet so a user can click
on the button to go directly to a specific line.

thanks..
 
R

Ron de Bruin

Hi

Try this example for column A

This will select the first cell in column A with the InputBox value.

Sub Find_First()
Dim FindString As String
Dim Rng As Range
FindString = InputBox("Enter a Search value")
If Trim(FindString) <> "" Then
Set Rng = Range("A:A").Find(What:=FindString, _
After:=Range("A" & Rows.Count), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Application.Goto Rng, True
Else
MsgBox "Nothing found"
End If
End If
End Sub
 
Top