View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Help with Traping (I believe) a no-Find() error throuh the us of aseemingly unrelated functiom

If you're using the Find method, I think you'll be better served by using
something like:

Dim FoundCell as Range
....

with someRangeHere
set foundcell = .cells.find(What:="something", After:=.cells(1), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
End with

If foundcell is nothing then
'not found, what should happen
else
'found it. Do what you want to FoundCell here
foundcell.offset(0,1).clearconents 'whatever
end if

==========
If you're using worksheetfunction.find() to check for something in a string,
then use VBA's instr() instead.



wrote:

2003 - 2007

Last year I needed help trapping a no-find error in VBA for Excel.

I think that the answer used isnumeric() to trap the error from blowing up succeeding VBA.

In short, the initial function would throw an error which was not easily trapped.

One of the MVP crew, used I believe an isnumeric() to trap that error.

I thought I had documented that synergistic coupling of functions but did not.

Anyone have ideas of coupling seemingly unrelated functions to trap?

TIA EagleOne


--

Dave Peterson