Search and Goto

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to create a formular or macro that when a number is typed, it will
take you to the cell. I know about the find feature, but if there is a way to
search and goto, that would be preferable.
 
I need to create a formular or macro that when a number is typed, it will
take you to the cell. I know about the find feature, but if there is a way to
search and goto, that would be preferable.

OK is clicked, it will locate the first occurrence of that value in
the active worksheet.
Sub findMe()
Dim nput As String, found As Range
nput = InputBox("Enter what to find")
If nput <> "" Then
Set found = Cells.Find(What:=nput, After:=Cells(1, 1), _
LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not found Is Nothing Then
Range(found.Address).Activate
Else
MsgBox nput & " not found"
End If
End If
End Sub
 
Back
Top