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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| Private Sub Workbook_Open()
Application.ScreenUpdating = False
With Application
.DisplayFullScreen = True
.DisplayStatusBar = False
.DisplayFormulaBar = False
.OnKey "{ESCAPE}", ""
End With
With ActiveWindow
.DisplayWorkbookTabs = False
.DisplayHeadings = False
.DisplayVerticalScrollBar = True
End With
ActiveSheet.ScrollArea = "A1:Q80"
Call Arobase
ActiveSheet.Protect
Application.ScreenUpdating = True
Dim Cel As Range, iRow&, Périmés$, L&, Certificat$, x&, Règlement$, k&
iRow = Range("L" & Rows.Count).End(xlUp).Row
With ActiveSheet
For Each Cel In Range("L3:L" & iRow)
If Len(Cel) > 0 Then
If Date >= DateAdd("yyyy", 3, Cel.Value) Then
L = L + 1
Périmés = Périmés & vbTab & Application.Proper(Cells(Cel.Row, "B")) & " " & UCase(Cells(Cel.Row, "C")) & " " & Application.Proper(Cells(Cel.Row, "D")) & vbCrLf
End If
End If
Next
End With
If L > 0 Then MsgBox "Le certificat des personnes suivantes est périmé :" & vbCrLf & Périmés, vbExclamation, "Certificat Médical"
With ActiveSheet
iRow = .Range("M" & Rows.Count).End(xlUp).Row
For Each Cel In .Range("M3:M" & iRow)
If Cel.Value = "" Then
x = x + 1
Certificat = Certificat & vbTab & Application.Proper(.Cells(Cel.Row, "B")) & " " & UCase(.Cells(Cel.Row, "C")) & " " & Application.Proper(.Cells(Cel.Row, "D")) & vbCrLf
End If
Next
End With
If x > 0 Then MsgBox "Le certificat des personnes suivantes est attendu :" & vbCrLf & Certificat, vbExclamation, "Certificat"
With ActiveSheet
iRow = .Range("N" & Rows.Count).End(xlUp).Row
For Each Cel In .Range("N3:N" & iRow)
If Cel.Value = "" Then
k = k + 1
Règlement = Règlement & vbTab & Application.Proper(.Cells(Cel.Row, "B")) & " " & UCase(.Cells(Cel.Row, "C")) & " " & Application.Proper(.Cells(Cel.Row, "D")) & vbCrLf
End If
Next
End With
If k > 0 Then MsgBox "Le Règlement des personnes suivantes est attendu :" & vbCrLf & Règlement, vbExclamation, "Règlement"
End Sub |
Partager