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

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Status
Not open for further replies.

Watch MrExcel Video

Forum statistics

Threads
1,118,974
Messages
5,575,308
Members
412,655
Latest member
habercio
Top