Option Explicit Public Sub Protege(blnProt As Boolean) Dim wstAux As Worksheet For Each wstAux In ThisWorkbook.Worksheets If blnProt Then wstAux.Protect "PASSWORD" Else wstAux.Unprotect "PASSWORD" End If Next wstAux End Sub
2009/5/21 suresh k <brave.sur...@gmail.com> > Hi All, > > Can anyone provide the vba code to protect and unprotect all sheets in > excel. > > Thanks & regards, > Suresh > > > > -- Fabio L Lemos email: flnle...@gmail.com --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---