b is column no 2 g is column no 7 target.row will select the row
On Thu, Dec 30, 2010 at 1:39 PM, ashish koul <koul.ash...@gmail.com> wrote: > **Private Sub Worksheet_Change(ByVal Target As Range) > If Target.Column = 1 Then > > 'target.column =3 because column c is no 3 column > > 'you can change password ashish and choose your own > > > > ActiveSheet.Unprotect Password:="ashish" > If Not IsEmpty(Target.Value) And Target.Value = "Yes" Then > > Cells(Target.Row, 2).Locked = True > > Cells(Target.Row, 7).Locked = True > > End If > ActiveSheet.Protect Password:="ashish" > Else: End If > End Sub > > > On Thu, Dec 30, 2010 at 12:42 PM, Manish <pansari.man...@gmail.com>wrote: > >> Thanks Ashish, >> >> This is perfect as i want. >> I need some more help, If i want to lock only column B to G (not want >> to lock entire row) than what will the code. >> I want to understand the diff in codes. :) >> >> Thanks once again for your help. >> >> Regds, >> Manish >> >> On Dec 30, 10:31 am, ashish koul <koul.ash...@gmail.com> wrote: >> > Private Sub Worksheet_Change(ByVal Target As Range) >> > If Target.Column = 1 Then >> > >> > 'target.column =3 because column c is no 3 column >> > >> > 'you can change password ashish and choose your own >> > >> > ActiveSheet.Unprotect Password:="ashish" >> > If Not IsEmpty(Target.Value) And Target.Value = "Yes" Then >> > >> > Rows(Target.Row & ":" & Target.Row).Select >> > Selection.Locked = True >> > End If >> > ActiveSheet.Protect Password:="ashish" >> > Else: End If >> > End Sub >> > >> > check this >> > >> > http://akoul.blogspot.com/2010/06/lock-cell-after-data-entry-from-edi. >> .. >> > >> > >> > >> > >> > >> > On Thu, Dec 30, 2010 at 10:38 AM, Manish <pansari.man...@gmail.com> >> wrote: >> > > Any help/suggestion ??? >> > >> > > Thanks, >> > > Manish >> > >> > > On Dec 29, 3:03 pm, Manish Pansari <pansari.man...@gmail.com> wrote: >> > > > Dear EE, >> > >> > > > Is it possible to lock the entire row/selected cell based on >> condition >> > > > in particular Cell. >> > > > for example, I want to lock the row based on value in column A. If >> > > > macro found value "yes" in cell A1 & A5, Macro will lock the row 1 & >> > > > row 5. >> > >> > > > I hope its possible in macro. Pls suggest me the code. >> > >> > > > Thnxs, >> > > > Manish >> > >> > > -- >> > >> > > >> ---------------------------------------------------------------------------------- >> > > 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 athttp://www.excel-macros.blogspot.com >> > > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com >> > > 5. Excel Tips and Tricks athttp://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&. >> .. >> > >> > -- >> > *Regards* >> > * * >> > *Ashish Koul* >> > *akoul*.*blogspot*.com <http://akoul.blogspot.com/> >> > *akoul*.wordpress.com <http://akoul.wordpress.com/> >> > My Linkedin Profile <http://in.linkedin.com/pub/ashish-koul/10/400/830> >> > >> > P Before printing, think about the environment. >> > >> > testlock.xls >> > 45KViewDownload- Hide quoted text - >> > >> > - Show quoted text - >> >> -- >> >> ---------------------------------------------------------------------------------- >> 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 >> > > > > -- > *Regards* > * * > *Ashish Koul* > *akoul*.*blogspot*.com <http://akoul.blogspot.com/> > *akoul*.wordpress.com <http://akoul.wordpress.com/> > My Linkedin Profile <http://in.linkedin.com/pub/ashish-koul/10/400/830> > > > P Before printing, think about the environment. > > > -- *Regards* * * *Ashish Koul* *akoul*.*blogspot*.com <http://akoul.blogspot.com/> *akoul*.wordpress.com <http://akoul.wordpress.com/> My Linkedin Profile <http://in.linkedin.com/pub/ashish-koul/10/400/830> P Before printing, think about the environment. -- ---------------------------------------------------------------------------------- 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