Protecting worksheets in file w/o going into ea worksheet

M

Markell

I would like to be able to protect a file without having
to go into each worksheet indivudally to protect? Is ther
a much quicker way? Example: We have payroll twice a
month, I have each two week payperiod in a sheet and want
to find an easier way to 'protect' them as a whole and not
individually. Help please, make my life easier!
 
H

Harald Staff

Hi

Absolutely. Two small macros are all it takes -assuming you can live with static identical
passwords on the sheets. Variations are possible for a minor charge <g>:

Sub LockAll()
Dim Sh As Worksheet
For Each Sh In ActiveWorkbook.Worksheets
Sh.Protect ("says me")
Next
End Sub

Sub OpenAll()
Dim Sh As Worksheet
For Each Sh In ActiveWorkbook.Worksheets
Sh.Unprotect ("says me")
Next
End Sub
 
M

Markell

I am not really sure what you mean, but I think I'll ask
one of our techy's here at work to explain what you
wrote. Thank you for your response. I am so looking
forward to this!!! :)
-----Original Message-----
Hi

Absolutely. Two small macros are all it takes -assuming
you can live with static identical
 
H

Harald Staff

As if we didn't have a few techies hidden around in this very place...

Open the VB editor (Alt F11 or the Tools > Macro menu).
Insert amodule there (Insert menu)
Paste my macros into the modules.
Return to Excel.
Save.
Run the desired macro from the Tools > Macro > Run menu.

Next time you open the file it says "this workbook contain macros, they are probably virus
from foreign countries that will cause you incredible problems and also set fire to the
the rain forest" -don't believe it. Those macros are your new friends. Enable them and
they will protect and unprotect your worksheets for years and for free.
 

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

Top