Dear Lucky Ji., Thanks for your valuable help. I am having a requirement of protecting the entire sheet.
The query is - How should i lock a particular book with a pass word. When ever a user tries to open that work book it has to be asked password. Then only the sheet should open and the contents of the sheet should be visible. Can u help me on this. Thank you, Regards, Saroj. On Tue, Aug 2, 2011 at 6:10 PM, lucky singh <lucky60...@gmail.com> wrote: > > 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 excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > Like our page on facebook , Just follow below link > http://www.facebook.com/discussexcel > -- ---------------------------------------------------------------------------------- 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/discussexcel