View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
StargateFan[_3_] StargateFan[_3_] is offline
external usenet poster
 
Posts: 171
Default Vital: Protecting sheets so macros/buttons still work?

On Wed, 30 Jun 2004 10:38:24 -0400, "StargateFanFromWork"
wrote:

This is a big one, it's become extremely vital. Over last 3 weeks I have
done a lot of work writing up several workbooks that contain numerous
buttons with macros assigned to them. One false step or accidental delete
and those buttons are gone! But when I protect the sheet, all the buttons
return error codes.

Can someone pls direct me to a webpage tutorial that explains how to protect
sheets so that the buttons will still work? I understand how to lock cells
and such, that I've been doing for years, it's protecting the sheet as per
normal but allowing the buttons full functionality.

Thank you!


Thank you so much to Dave Peterson who gave code that worked great in
my test file here at home. Here is the syntax, the only thing that
needs modifying is the macro name and the code one puts in that the
macro deals with, of course <g:

Sub MacroName()
'
With ActiveSheet
.Unprotect
(code goes here)
End With
End Sub



The above allowed me to apply _one_ unprotect/protect lines of code to
the macros regardless of sheet names. So in this test file, where I
had 10 sheets, 2 macros did the job! If I had not had a generic type
of code - in other examples where the sheet name had to be entered, in
other words - 20 different macros would have been required! Not a
pleasant prospect.

Thank you so much to Dave for this! This was the last major hurdle
<crossing fingers to fix on all the workbooks. The remaining two
weeks will allow me to test the files fully as I continue doing my job
which requires using these files on a daily basis.

Cheers!