Je vous remerciant à nouveau pour votre aide et l'attention que vous avez accordée à mon message.
je pense que vous avez raison ric , par ce que le fichier était fonctionne bien jusqu'à ce que je mette les deux macro qui j'ai trouvée sur YouTube pour protéger le fichier, la première:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWorkbook.Protect ("compta130882"), Structure:=False, Windows:=False
Application.DisplayAlerts = False
Sheets("SOMMAIRE").Select
Application.DisplayAlerts = True
Application.DisplayAlerts = False
Application.ScreenUpdating = False
nbre = ThisWorkbook.Sheets.Count
For i = 1 To nbre
If Sheets(i).Name <> "SOMMAIRE" Then
Sheets(i).Visible = xlVeryHidden
End If
Next
Application.ScreenUpdating = True
Application.DisplayAlerts = True
ActiveWindow.DisplayWorkbookTabs = False
ActiveWorkbook.Protect ("compta130882"), Structure:=True, Windows:=False
End Sub
et la deuxième:
Private Sub irg_Click()
Set login = Range("periodess").Find(SALAIRE.EXONERE.Value, LookIn:=xlValues, lookat:=xlWhole)
Set mdp = Range("periodess").Find(SALAIRE.PRORATA.Value, LookIn:=xlValues, lookat:=xlWhole)
If login Is Nothing Or mdp Is Nothing Then
MsgBox "Mot de passe incorrect"
SALAIRE.EXONERE.Value = ""
SALAIRE.PRORATA.Value = ""
Me.EXONERE.SetFocus
Exit Sub
End If
If Not login Is Nothing And Not mdp Is Nothing And login.Row Then
Application.ScreenUpdating = False
nbre = ThisWorkbook.Sheets.Count
For i = 1 To nbre
ActiveWorkbook.Protect ("compta130882"), Structure:=False, Windows:=False
Sheets(i).Visible = 1
Sheets("2").Visible = xlVeryHidden
Sheets("4").Visible = xlVeryHidden
Sheets("3").Visible = xlVeryHidden
Sheets("5").Visible = xlVeryHidden
Sheets("1").Visible = xlVeryHidden
Next i
Application.ScreenUpdating = True
Unload SALAIRE
ActiveWorkbook.Protect ("compta130882"), Structure:=True, Windows:=False
Else
MsgBox "Mot de passe incorrect"
SALAIRE.EXONERE.Value = ""
SALAIRE.PRORATA.Value = ""
Me.EXONERE.SetFocus
ActiveWorkbook.Protect ("compta130882"), Structure:=True, Windows:=False
Sheets("SOMMAIRE").Select
End If
End Sub.