Protecting Multiple Sheets with a Macro


Posted by John Cole on February 12, 2002 10:55 PM

Trying to protect each sheet in a multi sheet - workbook. Rather than protect each sheet and type a password each time, tried using a macro. Recorded the macro typing in the password each time. When the macro is run the sheets become protect but with no password. It appears the password is not recorded in the macro. Any ideas???



Posted by Ivan F Moala on February 12, 2002 11:26 PM

This is correct in that some functions are NOT
recorded by he macro recorder.

something like this will protect them all

Sub protectsheets()
Dim Sh As Worksheet

For Each Sh In ThisWorkbook.Sheets
Sh.Protect "YourPassword"
Next
End Sub


HTH

Ivan