Option Explicit
Sub cloturer()
Dim ligne As Long
With ActiveSheet
If .Name = "OT-VIERGE" Then
MsgBox ("Vous ne pouvez pas clôturer Le fichier.xlsm"): Exit Sub
End If
If InputBox("Merci de saisir le mot de passe", , , 1000, 3000) <> "chalet53" Then
MsgBox "Fermeture non autorisée": Exit Sub
End If
If .Range("L5").Value <> "Résolu" Then
MsgBox ("Clôture impossible, la cellule L5 n'est pas à jour"): Exit Sub
End If
.Unprotect
With .Range("A6:L200")
.Locked = True
.FormulaHidden = False
End With
.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ligne = Workbooks("TABLEAU-OT.xlsm").Worksheets("Synthèse").Cells(1, 27).Value
End With
Workbooks("TABLEAU-OT.xlsm").Worksheets("Synthèse").Cells(ligne, 9) = "Résolu"
ActiveWorkbook.Save
Application.DisplayAlerts = False
ThisWorkbook.Close
Application.DisplayAlerts = True
End Sub