can't find cells

G

greymun

New to all this, bit confusing. I'm trying to find find cells and once found move them, there is no problem finding a cell by matching the text but it falls apart when the text doesn't exist in a cell. I need a simple 'if..then MsgBox' thing but can't figure out what it is, any chance anyone else has an idea?
 
J

JE McGimpsey

One way:

Dim rFound As Range
Set rFound = Cells.Find( _
What:="the text", _
LookIn:=xlValues, _
LookAt:=xlWhole, _
MatchCase:=False)
If Not rFound Is Nothing Then
'Move cell
Else
MsgBox """the text"" was not found"
End If
 
G

greymun

cheers, looks good, but wont work cos now it requires an object with the find cells, am I missing something obvious?
 
G

greymun

Ha! You were right, it took me a while to figure it out but I got there in
the end, thank you very much.
 

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