Below code is not working fine.
Private Sub Worksheet_Change(ByVal Target As Range) Dim rngNonDelete As Range Set rngNonDelete = Range("H:J") If Not Intersect(Target, rngNonDelete) Is Nothing Then Application.EnableEvents = False If Target.Column = 2 Then ' confirm = MsgBox("Do you wish to confirm entry of this data?" _ ' & vbCrLf & "You will not be allowed to change it!", vbYesNo, "confirm Entry") ' Select Case confirm ' Case Is = vbYes Dim Cell As Range With ActiveSheet .Unprotect Password:="asdf,1234?" .Cells.Locked = False For Each Cell In ActiveSheet.UsedRange If Cell.Value = "" Then Cell.Locked = False Else Cell.Locked = True End If Next Cell .Protect Password:="asdf,1234?" End With ' Case Is = vbNo ' Application.Undo ' End Select End If Application.EnableEvents = True End If End Sub
What i want is lock only H:J range of column and unlock rest of all.
Can anyone help me in this.. Please its urgent