1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| Dim modifs As Boolean
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
modifs = True
End Sub
Public Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Application.DisplayAlerts = False
ThisWorkbook.SaveAs ThisWorkbook.Path & "\Gestion " & Format(Now, "dddd dd mmm yyyy", vbMonday) & ".xlsm"
Application.DisplayAlerts = True
If modifs = True Then
With Worksheets("Compte").[A3]
.ClearFormats
.NumberFormat = "@"
.Value = "Dernier accès le " & Format(Date, "dd mm yyyy") & " à " & Format(Time, "H:MM")
.Font.Name = "Arial"
.Font.Size = 11
.VerticalAlignment = xlCenter
.HorizontalAlignment = xlCenter
.Characters(1, 1).Font.ColorIndex = 3 'Pour mettre le D
.Characters(1, 1).Font.Bold = True
.Characters(2, 37).Font.ColorIndex = 1 'Retour a la normal
.Characters(2, 37).Font.Bold = False
.Characters(29, 1).Font.ColorIndex = 3 'Pour le à
.Characters(29, 1).Font.Bold = True
.Characters(39, 6).Font.ColorIndex = 1 'Retour a la normal
.Characters(39, 6).Font.Bold = False
End With
End If
End Sub |
Partager