Private Sub Workbook_BeforeClose(Cancel As Boolean)
'Application.StatusBar = "Prennez le temps d'aller boire un café, j'effectue la sauvegarde"
UserForm1.Show vbModeless
'For i = 1 To 10000 '10000
'UpDateProgressBar (i / 10000) '(i / 10000)
'Next
Sheets("AIR ").Select
ActiveSheet.Unprotect
Range("A140").Select
k = ActiveCell.Value 'Colonne à verrouiller
l = ActiveCell.Value
Plage = Cells(12, l).Address + "," + Range(Cells(16, l), Cells(17, l)).Address
Range(Plage).Select
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("ESSI").Select
ActiveSheet.Unprotect
Range("A140").Select
k = ActiveCell.Value 'Colonne à verrouiller
l = ActiveCell.Value
Plage = Cells(12, l).Address + "," + Range(Cells(16, l), Cells(17, l)).Address
Range(Plage).Select
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("GEMA").Select
ActiveSheet.Unprotect
Range("A140").Select
k = ActiveCell.Value 'Colonne à verrouiller
l = ActiveCell.Value
Plage = Cells(12, l).Address + "," + Range(Cells(16, l), Cells(17, l)).Address
Range(Plage).Select
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("ICAD").Select
ActiveSheet.Unprotect
Range("A140").Select
k = ActiveCell.Value 'Colonne à verrouiller
l = ActiveCell.Value
Plage = Cells(12, l).Address + "," + Range(Cells(16, l), Cells(17, l)).Address
Range(Plage).Select
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("INGE").Select
ActiveSheet.Unprotect
Range("A140").Select
k = ActiveCell.Value 'Colonne à verrouiller
l = ActiveCell.Value
Plage = Cells(12, l).Address + "," + Range(Cells(16, l), Cells(17, l)).Address
Range(Plage).Select
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("IPSE").Select
ActiveSheet.Unprotect
Range("A140").Select
k = ActiveCell.Value 'Colonne à verrouiller
l = ActiveCell.Value
Plage = Cells(12, l).Address + "," + Range(Cells(16, l), Cells(17, l)).Address
Range(Plage).Select
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("LORE").Select
ActiveSheet.Unprotect
Range("A140").Select
k = ActiveCell.Value 'Colonne à verrouiller
l = ActiveCell.Value
Plage = Cells(12, l).Address + "," + Range(Cells(16, l), Cells(17, l)).Address
Range(Plage).Select
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("SCOR").Select
ActiveSheet.Unprotect
Range("A140").Select
k = ActiveCell.Value 'Colonne à verrouiller
l = ActiveCell.Value
Plage = Cells(12, l).Address + "," + Range(Cells(16, l), Cells(17, l)).Address
Range(Plage).Select
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("SES").Select
ActiveSheet.Unprotect
Range("A140").Select
k = ActiveCell.Value 'Colonne à verrouiller
l = ActiveCell.Value
Plage = Cells(12, l).Address + "," + Range(Cells(16, l), Cells(17, l)).Address
Range(Plage).Select
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("VINC").Select
ActiveSheet.Unprotect
Range("A140").Select
k = ActiveCell.Value 'Colonne à verrouiller
l = ActiveCell.Value
Plage = Cells(12, l).Address + "," + Range(Cells(16, l), Cells(17, l)).Address
Range(Plage).Select
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Evolution").Select
Range("A137").Select
k = 1
l = ActiveCell.Value
Cells(k, l - 6).Select
Range("A1").Select
Sheets("Evolution (Moy. mobiles)").Select
Range("A136").Select
k = 1
l = ActiveCell.Value
Cells(k, l - 6).Select
Range("A1").Select
Sheets("Evol. vs. CAC").Select
Range("A110").Select
k = 1
l = ActiveCell.Value
Cells(k, l - 6).Select
Range("A1").Select
Sheets("Rendement").Select
Range("A110").Select
k = 1
l = ActiveCell.Value
Cells(k, l - 6).Select
Range("A1").Select
Sheets("Rendement (moy. mobiles)").Select
Range("A110").Select
k = 1
l = ActiveCell.Value
Cells(k, l - 6).Select
Range("A1").Select
Sheets("Sélection").Select
Saisie_Cours_Verrouiller
ActiveWorkbook.Save
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\Edmond\Documents\Médoc (Excel 2003)\R'sIG\Sélection Barre Copie.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
'Range("A1").Select
Dim sht As Worksheet
Dim MotPass
MotPass = InputBox("Saisissez le mot de passe :", "R'sIG")
Unload UserForm1
Dim bonjour As String
bonjour = MsgBox(prompt:="Le R'sIG vous remercie de votre visite et espère vous revoir bientôt.", Title:="Espace 'Rékia's I G'")
'décommenter la ligne suivante pour que le programme se termine après l'affichage du message
'unload me
End Sub