VBA Code to keep the filter option working for the users beside lock the cell after editing with massage box VBA Code.

Status
Not open for further replies.

Tariq384

New Member
Joined
Jul 23, 2020
Messages
10
Office Version
  1. 2013
Platform
  1. Windows
Please advise , I have the code to lock the cell after editing with massage box , but i want to keep the filter option working for the users.

this the code i have

Private Sub Worksheet_Change(ByVal Target As Range)

ActiveSheet.Unprotect Password:="01234"
For Each cl In Target
If cl.Value <> "" Then
check = MsgBox("Is this entry correct? This cell cannot be changed after entering this value.", vbYesNo, "Cell Lock Notification")
If check = vbYes Then
cl.Locked = True
Else
cl.Value = ""
End If
End If
Next cl
ActiveSheet.Protect Password:="01234"
End Sub
 

Some videos you may like

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Status
Not open for further replies.

Watch MrExcel Video

Forum statistics

Threads
1,119,090
Messages
5,576,044
Members
412,697
Latest member
khanhvy31
Top