View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Jan Karel Pieterse Jan Karel Pieterse is offline
external usenet poster
 
Posts: 535
Default how to record macro for passwords

Hi Sherees,

I have more than fifty sheets, which i want to lock with a password? I have
tried to record macro but it does not work as intended. When I run the
recorded macro, it protects the sheet but without the password. Solution
Please!


You can use code like this:

Sub ProtectAllSheets()
Dim oSh As Worksheet
For Each oSh In Worksheets
oSh.Protect "Password"
Next
End Sub

Of course you need to change the password...

Regards,

Jan Karel Pieterse
Excel MVP
http://www.jkp-ads.com
Member of:
Professional Office Developer Association
www.proofficedev.com