Dear Sir I have used this code in one of my project viz.
Private Sub Worksheet_Activate() Sheet2.Protect "1823" Dim pass As String pass = InputBox("N Shivkumar has for obvious reasons set a Password, kindly enter password to unprotect sheet") If pass = "1823" Then Sheet2.Unprotect "1823" Else MsgBox " Incorrect Password" Worksheets(1).Activate End If End Sub N.SHIVKUMAR Mobile : +919866533180 Office : +914027685310 Res. : +914040035774 Alternate Email: shiv1...@yahoo.com On 8 April 2010 13:56, rf1234 rf1234 <rfhyd1...@gmail.com> wrote: > Hello Dear, > > Following is the Code to Protect Unprotect Excel Sheet Using VBA. > > > > > > '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' > Sub ProtectSheet() > Dim Password 'This line of code is optional > Password = "1234aBcD" > ActiveSheet.Protect Password, True, True, True > End Sub > > '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' > Sub UnProtectSheet() > Password = "1234aBcD" > ActiveSheet.Unprotect Password > End Sub > > > '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' > > > > > > > > > Hope it Will Help > Happy To Help > :) > Shyam > > On Fri, Mar 26, 2010 at 5:40 PM, Jai <jaihumtu...@gmail.com> wrote: > > DEAR ALL,EXPERTS > > > > Can you Tell me that how can protect the excel sheet in VBA Passward. > > > > > > > > -- > > Thanks For Mail. > > > > -- > > > ---------------------------------------------------------------------------------- > > Some important links for excel users: > > 1. Follow us on TWITTER for tips tricks and links : > > http://twitter.com/exceldailytip > > 2. Join our Facebook Group @ > > http://www.facebook.com/group.php?gid=287779555678 > > 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 > > > > <><><><><><><><><><><><><><><><><><><><><><> > > HELP US GROW !! > > > > We reach over 6,800 subscribers worldwide and receive many nice notes > about > > the learning and support from the group.Let friends and co-workers know > they > > can subscribe to group at > > http://groups.google.com/group/excel-macros/subscribe > > > > To unsubscribe from this group, send email to > > excel-macros+unsubscribegooglegroups.com or reply to this email with the > > words "REMOVE ME" as the subject. > > > > > > -- > > Thanks Regards > Shyam > Software Engineer > > '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' > When one door of happiness closes, another opens; > but often we look so long at the closed door that we do not see the > one which has been opened for us. > - Helen Keller > > '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' > Wenn eine Tür des Glücks schließt, öffnet sich ein weiteres, > aber oft schauen wir so lange auf die geschlossene Tür, > dass wir nicht sehen ein, die für uns geöffnet wurde. - Helen Keller > > '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' > > -- > > ---------------------------------------------------------------------------------- > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip > 2. Join our Facebook Group @ > http://www.facebook.com/group.php?gid=287779555678 > 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 > > <><><><><><><><><><><><><><><><><><><><><><> > HELP US GROW !! > > We reach over 6,800 subscribers worldwide and receive many nice notes about > the learning and support from the group.Let friends and co-workers know they > can subscribe to group at > http://groups.google.com/group/excel-macros/subscribe > -- ---------------------------------------------------------------------------------- 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 <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 6,800 subscribers worldwide and receive many nice notes about the learning and support from the group.Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe