Easy one: Using Search (Ctrl+F)

P

Paul

I wrote a macro that takes the text in the active cell
and plugs it into the Excel search thingy. Here's the code:

AAAA = ActiveCell.Text

Sheets("LIST").Select
Range("A1").Select
Cells.Find(What:=AAAA, After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False).Activate

BUT IT DOESN'T WORK. Please!! - HELP!
Paul
 
T

Tom Ogilvy

Sub Testfind()
AAAA = ActiveCell.Text

Sheets("LIST").Select
Range("A1").Select
Set rng = Cells.Find(What:=AAAA, _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
rng.Select
Else
MsgBox AAAA & " was not found"
End If
End Sub

Worked for me.

perhaps try

AAAA = ActiveCell.Value

Are you looking for a date? Finding dates can be problematic using Find.

Post back with more information if the above does not work.

Regards,
Tom Ogilvy
 

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

Top