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
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Status
Not open for further replies.

Forum statistics

Threads
1,215,548
Messages
6,125,472
Members
449,231
Latest member
Sham Yousaf

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top