Hi Suresh

Try following code:-

Sub protect()
On Error GoTo Myerr
For i = 1 To Sheets.Count
ActiveSheet.protect
ActiveSheet.Previous.Select
Next
Exit Sub
Myerr:
MsgBox ("all sheets are protected now")
End Sub
Thanks,
-- 
DILIP KUMAR PANDEY
  MBA-HR,B COM(Hons.),BCA
Mobile: +91 9810929744
dilipan...@gmail.com
dilipan...@yahoo.com
New Delhi - 110062
On Thu, May 21, 2009 at 8:11 PM, suresh k <brave.sur...@gmail.com> wrote:

> Hi All,
>
> Can anyone provide the vba code to protect and unprotect all sheets in
> excel.
>
> Thanks & regards,
> Suresh
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
-------------------------------------------------------------------------------------
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
-------------------------------------------------------------------------------------
-~----------~----~----~----~------~----~------~--~---

Reply via email to