Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim c As Range, Feuille As Worksheet
For Each Feuille In ThisWorkbook.Worksheets
Feuille.Unprotect Password:=""
For Each c In Feuille.Range("A1:J1000")
If c.Value <> "" Then
If c.MergeCells Then
c.MergeArea.Locked = True
Else
c.Locked = True
End If
End If
Next
ActiveSheet.Protect Password:="", DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, AllowInsertingRows _
:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, _
AllowDeletingRows:=True, AllowSorting:=True, AllowFiltering:=True, _
AllowUsingPivotTables:=True
ActiveSheet.EnableSelection = xlNoRestrictions
Next
End Sub