Find/Found

  • Thread starter Thread starter Gordon
  • Start date Start date
G

Gordon

Can not get Found to respond. Object: Get PersonName in Sheet2, Go to
Sheet1, Find PersonName. If Found put PersonName & address into Sheet2
Else put PersonName in Sheet3. Sheet2 has no address. Sheet1 has most,
but not all names that are in Sheet2

Tried:
Set Found = Nothing
Set Found = Cells.Find(PersonName)
..
Cells.Find(What:=PersonName.....
If Found Nothing Then ..

Thanks again for all your help,
Gordon
 
Hi Gordon,

Try this:-

PersonName = Sheets("Sheet2").Range("A1")
Set Found = Nothing

With Worksheets("Sheet1").Cells
Set Found = .Find(What:=PersonName, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)

If Not Found Is Nothing Then
'Insert your required processing here in lieu of Msgbox
MsgBox "Person Name " & PersonName & " found"
End If
End With
 
Hi again Gordon,

I meant to include the alternative code for the if test

'Alternative code for if test
If Found Is Nothing Then
MsgBox "Person Name " & PersonName & " not found"
End If

Regards,

OssieMac
 
Back
Top