View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dnereb[_5_] Dnereb[_5_] is offline
external usenet poster
 
Posts: 1
Default Macros for Protect/Unprotect all sheets in a workbook


on resume next is used to ignore or handle errors yourself

if an error occurs the code will continue on the next line

in this case the error raised if the password is incorrect is ignored
and another try is made.
the real bad part of this code is the lack of the statement:

Code:
--------------------
On error goto 0
--------------------

just before the end of the sub. in this piece of $#%^$%^ you will end
up ignoring errors in the rest of your code resulting in very
unpredictable results.
So take it from me for every _resume_next___ You should have at least 1
_goto_0_


--
Dnereb
------------------------------------------------------------------------
Dnereb's Profile: http://www.excelforum.com/member.php...o&userid=26182
View this thread: http://www.excelforum.com/showthread...hreadid=392821