View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default 'Search' problem

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:=x lwhole)
if c is nothing then
msgbox("data is not found")
else
msbox("data is found at : " & c.address)
end if

" wrote:

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.