Hi,
Try this.
 
Sub Macro6()
If ActiveSheet.ProtectContents = True Then ActiveSheet.Unprotect Else 
ActiveSheet.Protect
End Sub
 
Regards - Dave.
 
> Date: Wed, 8 Dec 2010 20:49:58 +0530
> Subject: $$Excel-Macros$$ how to protect & unprotect the sheet with same 
> button
> From: rajeshkainikk...@gmail.com
> To: excel-macros@googlegroups.com
> 
> Hi Experts
> 
> i am want to give an edit button in my worksheet, for protecting &
> unprotecting the sheet how can i use it. I try this code but not
> working,pls correct it
> 
> Sub Macro6()
> If ActiveSheet.Protect = True Then
> ActiveSheet.Unprotect
> Else
> If ActiveSheet.Protect = False Then
> ActiveSheet.Protect
> End If
> End If
> End Sub
> 
> Regards
> Rajesh Kainikkara
> 
> -- 
> ----------------------------------------------------------------------------------
> Some important links for excel users:
> 1. Follow us on TWITTER for tips tricks and links : 
> http://twitter.com/exceldailytip
> 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
> 3. Excel tutorials at http://www.excel-macros.blogspot.com
> 4. Learn VBA Macros at http://www.quickvba.blogspot.com
> 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
> 
> To post to this group, send email to excel-macros@googlegroups.com
> 
> <><><><><><><><><><><><><><><><><><><><><><>
> Like our page on facebook , Just follow below link
> http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts
                                          

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts

Reply via email to