i need a help
the below vba helps to lock the corresponding row when double clicked a cell in Column "W'
also when we unlock using unprotect sheet with password all the rows get unlocked.
i need this to be changed as -
lock the row only when i enter a value (say "105") in a cell (Say "BB1"),and the full row in the column A (containing value "105") should be locked. like wise there should be option in a cell (Say "BC1") to unlock a particular row too when value password given and value entered in "BC1"
Code:
PrivateSub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Dim AreYouSure AsLong
Set rng = Columns("W:W")
If Intersect(Target, rng) IsNothingThenExitSub
AreYouSure = MsgBox("Are you sure you want to lock this row? There's no going back from here...", _
vbYesNoCancel + vbQuestion, "Lock this row?")
If AreYouSure = 6 Then' True
With ActiveSheet
.Unprotect "password"
Target.EntireRow.Locked = True
.Protect "password"
Bookmarks