Hi Team,
Attached below is the Marco code for Protecting cells in excel sheet.
Steps to Protect a cell
Step 1 - Open that particular file which you want to lock and hide any
formulas in sheet.
Step 2 - Open file "PROTECT" and press CTRL + j
Steps to Unprotect a cell
Step 1 - Open that particular file which you want to Unlock
Step 2 - Open file "PROTECT" and press CTRL + Shift + j
Enjoy Guys
You can also use the below mentioned VB Codes...
Sub Protect()
'
' Protect Macro
'
' Keyboard Shortcut: Ctrl+j
'
Cells.Select
Selection.Locked = True
Selection.FormulaHidden = True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True _
, AllowFormattingCells:=True
End Sub
Sub Unprotect()
'
' Unprotect Macro
'
' Keyboard Shortcut: Ctrl+Shift+J
'
ActiveSheet.Unprotect
Cells.Select
Selection.Locked = False
Selection.FormulaHidden = False
End Sub
Regards,
Lucky
--
----------------------------------------------------------------------------------
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 [email protected]
<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel