View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
bhofsetz[_70_] bhofsetz[_70_] is offline
external usenet poster
 
Posts: 1
Default On Error GoTo If


JJD,
Have your On Error GoTo statement point to a specific line in th
sub where you are trying to trap the error, such as:

On Error GoTo errhndlr

Then at the bottom of your sub put the following

Exit Sub
errhndlr:
' - Then put whatever code you want to run if the error occurs
' - The IF statement in your case
' - IF your condition is true then use END to quit the entire macro

Be sure to have Exit Sub before your error handler so it will not ru
unless an error occurs.
Also make sure your errhndlr: line starts all the way to the left (i
not indented) and that it ends with the colon :

HT

--
bhofset
-----------------------------------------------------------------------
bhofsetz's Profile: http://www.excelforum.com/member.php...fo&userid=1880
View this thread: http://www.excelforum.com/showthread.php?threadid=38134