Option Explicit
Function mon_password()
mon_password = 'tonpassword'
End Function
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
ActiveSheet.Unprotect mon_password
Dim myrange As Range
Dim C As Variant
Set myrange = Range('A1:Z100')
For Each C In myrange
If C.Value <> '' And Cells(C.Row, C.Column).Locked = False Then
C.Select
Selection.Locked = True
MsgBox 'toto' 'permet de voir les cases qui sont vérifier par ce code (enleves le une fois que tu as compris)
End If
Next
ActiveSheet.Protect mon_password, DrawingObjects:=True, Contents:=True, _
Scenarios:=True
End Sub