'Search' problem

  • Thread starter Thread starter jon1814
  • Start date Start date
J

jon1814

Hi folks. Does anyone know how to search a sheet for a particular
reference (could be anything)... and if that reference does not exist,
then... 'do something else'. When you do a 'find' manually, and the
thing you're looking for doesn't exist... excel let's you know. But
when you try and do this in VB... if the reference isn't found, Excel
just continues running the code. Hope that makes sense.
 
Cells can be any Range object like Rows(1),
columns("D"),Range("A1:D4"),Rows("1:10")

set c = Cells.find(what:="abc"),lookin:=xlvalues,lookat:=xlwhole)
if c is nothing then
msgbox("data is not found")
else
msbox("data is found at : " & c.address)
end if
 

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