1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim Plg As Range
With Sheets(1)
'On déverrouille la feuille ici
.Unprotect Password:="TonMotDePasse"
On Error Resume Next
Set Plg = .Range("Y7:AJ" & Rows.Count).SpecialCells(xlCellTypeConstants).EntireRow
If Err Then Exit Sub
Set Plg = Intersect(.Range("C7:C" & Rows.Count).SpecialCells(xlCellTypeBlanks), Plg)
If Plg Is Nothing Then Exit Sub
Application.GoTo Plg
MsgBox "Veuillez indiquez PERM/TT dans la colonne C", vbOKOnly + vbExclamation
'On protège à nouveau la feuille ici
.protect Password:="TonMotDePasse"
End With
End SUB |