Ah, yes, small oversight on my behalf.
<font face=Courier New><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Worksheet_Change(<SPAN style="color:#00007F">ByVal</SPAN> Target <SPAN style="color:#00007F">As</SPAN> Range)<br> <br> <SPAN style="color:#00007F">If</SPAN> <SPAN style="color:#00007F">Not</SPAN> Intersect(Target, Columns("V")) <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#007F00">' the changed cell is in column V</SPAN><br> <SPAN style="color:#00007F">If</SPAN> Target.Cells.Count = 1 <SPAN style="color:#00007F">Then</SPAN><br> <SPAN style="color:#007F00">' only act if it is a single cell, so multicell copy will not trigger this</SPAN><br> <SPAN style="color:#00007F">If</SPAN> InStr(1, Target.Value, "PMT") <SPAN style="color:#00007F">Then</SPAN><br> Me.Unprotect Password:=""<br> Target.EntireRow.Locked = <SPAN style="color:#00007F">True</SPAN><br> Me.Protect Password:=""<br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>
<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> LockPMT()<br><SPAN style="color:#007F00">' Lock those rows where Column V contains "PMT"</SPAN><br> <SPAN style="color:#00007F">Dim</SPAN> rChk <SPAN style="color:#00007F">As</SPAN> Range, r1st <SPAN style="color:#00007F">As</SPAN> Range<br> <br> <SPAN style="color:#00007F">Set</SPAN> r1st = Columns("V").Find(What:="PMT", _<br> after:=Cells(Rows.Count, "V"), _<br> LookIn:=xlValues, lookat:=xlPart, _<br> searchdirection:=xlNext)<br> <SPAN style="color:#00007F">If</SPAN> <SPAN style="color:#00007F">Not</SPAN> r1st <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#007F00">' PMT is found</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> rChk = r1st<br> <SPAN style="color:#00007F">Do</SPAN><br> ActiveSheet.Unprotect Password:=""<br> rChk.EntireRow.Locked = <SPAN style="color:#00007F">True</SPAN><br> ActiveSheet.Protect Password:=""<br> <SPAN style="color:#00007F">Set</SPAN> rChk = Columns("V").FindNext(after:=rChk)<br> <SPAN style="color:#00007F">Loop</SPAN> <SPAN style="color:#00007F">While</SPAN> rChk.Address <> r1st.Address <SPAN style="color:#007F00">' else endless loop</SPAN><br> <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br> <br> <SPAN style="color:#00007F">Set</SPAN> r1st = <SPAN style="color:#00007F">Nothing</SPAN><br> <SPAN style="color:#00007F">Set</SPAN> rChk = <SPAN style="color:#00007F">Nothing</SPAN><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
If you lock with a password, supply it in the code