MACRO find and Go-To

  • Thread starter Thread starter Teddy-B
  • Start date Start date
T

Teddy-B

Can anyone help me? I have a list of names, addresses, SS #'s, etc. 5,000+ on
the list. I would like for the user to be able to type a SS# into a cell (C3)
and have a macro to find the unique (SS#) number in the list and then GO TO
that #. The user needs to be able to GO TO the row of data associated with
the unique (SS#) number that they typed into (C3).
I CANNOT GET EXCEL to FIND and GO TO with a macro. WHY, WHY, WHY????
I have tried everything for a week now and I'm at the end of my line....I
hate to give up. So if you hate to give up too and have ever felt alone and
defeated, please give me a hand up and help me to get this one...

Thanks:
 
If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.
 
Try the below macro...If you are looking for a partial cell match you can
replace xlWhole with xlPart.

Sub MacroFind()
Dim varFound As Variant, varSearch As Variant

varSearch = Range("C3")
Set varFound = Cells.Find(varSearch, LookAt:=xlWhole)
If Not varFound Is Nothing Then
Application.Goto varFound, True
Else
MsgBox "Cannot find" & Range("C3")
End If

End Sub

If this post helps click Yes
 
Sub go_to_num()
whatnum = ActiveSheet.Range("C3").Value
With ActiveSheet.UsedRange
Set c = .Find(whatnum, LookIn:=xlValues, lookat:=xlPart)
If Not c Is Nothing Then
FirstAddress = c.Address
Do
c.Select
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> FirstAddress
End If
End With
End Sub


Gord Dibben MS Excel MVP
 
Back
Top