error handler in macro?

  • Thread starter Thread starter Don
  • Start date Start date
D

Don

Want to do a selection.find on a column. How do I return
processing to macro if selection is NOT found?

THANKS
 
Hi
try
dim c as range
on error resume next
set C = range("A:A").find ....
on error goto 0
if not c is nothing then
'your code
end if
 
Enclose the relevant code in the following:

On error Resume Next

...Your code here..

On error GoTo 0

The first line forces execution to continue from the next
line if an error occurs and the second returns to normal
error-trapping.

You might want to make sure the rest of the code in this
block is robust before doing this, or you may end up with
some pretty wild results...

Cheers, Pete
 

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