PDA

View Full Version : How i can do this?



Esmatullah
12-10-2012, 04:59 AM
Hi dear friends!
How i can edit this macro code of automatic cell locking that don't lock when i double click for editing a cell in range and exit without editing. Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B7:D9")) Is Nothing Then Exit Sub
ActiveSheet.Unprotect Password:="Password"
Target.Locked = True
ActiveSheet.Protect Password:="Password"
End Sub

Esmatullah
01-06-2013, 06:19 AM
Is their any answer plz.

BrianMH
01-06-2013, 06:50 AM
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B7:D9")) Is Nothing or Target.Value = "" Then Exit Sub
ActiveSheet.Unprotect Password:="Password"
Target.Locked = True
ActiveSheet.Protect Password:="Password"
End Sub

That should work.

By the way your signature should read "I like to be helpful to my dear friends and I like helpful friends because "A friend in need is a friend indeed".

Not being a grammar Nazi just trying to help.