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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top