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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
| Private Sub UserForm_Activate()
Dim z As Long
Dim lastligne As Integer
lastligne = Sheets("Ansot").Range("A65536").End(xlUp).Row
Dim Msg, Style, Title, Response
MsgR1 = "Merci de renseignez les actions menées en relance 1"
MsgR2 = "Merci de renseignez les actions menées en relance 2"
MsgR3 = "Mercir de renseignez les actions menées en relance 3"
MsgPasR = "Il n'y a pas/plus de relance cette semaine"
Style = vbOKOnly
TitleR1 = "Relance1"
TitleR2 = "Relance2"
TitleR3 = "Relance3"
TitlePasR = "A jour"
For z = 2 To lastligne
If (Worksheets("Ansot").Cells(z, 4).Value <= DateAdd("d", -30, Date) And Worksheets("Ansot").Cells(z, 4).Value >= DateAdd("d", -37, Date) And (IsEmpty(Worksheets("Ansot").Cells(z, 20)) = True)) Then
ResponseR3 = MsgBox(MsgR3, Style, TitleR3)
If ResponseR3 = Ok Then
With UserForm3
.TextBoxA = Worksheets("Ansot").Cells(z, 1).Value
.TextBoxB = CDate(Cells(z, 2).Value)
.TextBoxC = CDate(Cells(z, 4).Value)
.TextBoxD = CDbl(Cells(z, 5).Value) * 1
.TextBoxE = Cells(z, 6).Value
.TextBoxF = CDbl(Cells(z, 13).Value) * 1
.TextBoxRE1 = Cells(z, 18).Value
.TextBoxRE2 = Cells(z, 19).Value
.TextBoxRE3 = Cells(z, 20).Value
.TextBoxREH = Cells(z, 21).Value
End With
Exit For
End If
ElseIf (Worksheets("Ansot").Cells(z, 4).Value <= DateAdd("d", -15, Date) And Worksheets("Ansot").Cells(z, 4).Value >= DateAdd("d", -29, Date) And (IsEmpty(Worksheets("Ansot").Cells(z, 19)) = True)) Then
ResponseR2 = MsgBox(MsgR2, Style, TitleR2)
If ResponseR2 = Ok Then
With UserForm3
.TextBoxA = Worksheets("Ansot").Cells(z, 1).Value
.TextBoxB = CDate(Cells(z, 2).Value)
.TextBoxC = CDate(Cells(z, 4).Value)
.TextBoxD = CDbl(Cells(z, 5).Value) * 1
.TextBoxE = Cells(z, 6).Value
.TextBoxF = CDbl(Cells(z, 13).Value) * 1
.TextBoxRE1 = Cells(z, 18).Value
.TextBoxRE2 = Cells(z, 19).Value
.TextBoxRE3 = Cells(z, 20).Value
.TextBoxREH = Cells(z, 21).Value
End With
Exit For
End If
ElseIf (Worksheets("Ansot").Cells(z, 4).Value <= DateAdd("d", -7, Date) And Worksheets("Ansot").Cells(z, 4).Value >= DateAdd("d", -14, Date) And IsEmpty(Worksheets("Ansot").Cells(z, 18)) = True) Then
ResponseR1 = MsgBox(MsgR1, Style, TitleR1)
If ResponseR1 = Ok Then
With UserForm3
.TextBoxA = Worksheets("Ansot").Cells(z, 1).Value
.TextBoxB = CDate(Cells(z, 2).Value)
.TextBoxC = CDate(Cells(z, 4).Value)
.TextBoxD = CDbl(Cells(z, 5).Value) * 1
.TextBoxE = Cells(z, 6).Value
.TextBoxF = CDbl(Cells(z, 13).Value) * 1
.TextBoxRE1 = Cells(z, 18).Value
.TextBoxRE2 = Cells(z, 19).Value
.TextBoxRE3 = Cells(z, 20).Value
.TextBoxREH = Cells(z, 21).Value
End With
Exit For
End If
Else: ResponsePasR = MsgBox(MsgPasR, Style, TitlePasR)
If ResponsePasR = Ok Then
Exit Sub
Unload Me
End If
End If
Next z
End Sub |
Partager