View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Celt
 
Posts: n/a
Default VBA code error with Protection turned on - help please


Hiya Fred.

Don't know if you solved your problem yet, but try dropping this into
your code (I have no idea if it will work with Excel 97):

ActiveSheet.Unprotect Password:="password"

*** your macro ***

ActiveSheet.Protect Password:="password"
ActiveSheet.EnableSelection = xlNoRestrictions

If you don't have a password then ust delete
"Password:="password""....otherwise stick in your specific password.

Where you drop it in is the question. I am guessing the unprotect
statement would go right after you identify your "ActiveSheet". The
protect statement would go right before your last "End Sub".

I use Excel2003 and this works fine for me, allowing me to run macros
on protected sheets.

good luck!


--
Celt
------------------------------------------------------------------------
Celt's Profile: http://www.excelforum.com/member.php...o&userid=19413
View this thread: http://www.excelforum.com/showthread...hreadid=390934