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
| Private Sub MajIndexEauDemine(MajMois As Boolean, MajJ_1 As Boolean, Optional MajJ As Boolean = False)
Dim Cpt As Integer
Dim IndexJ(1 To 4) As Variant, IndexJ_1(1 To 4) As Variant, IndexMois(1 To 4) As Variant, IndexMoisInit(1 To 4) As Variant
Dim IndexMoisInitVide As Boolean
IndexMoisInitVide = True
With Worksheets("IndexEd")
For Cpt = 2 To .Range("A65536").End(xlUp).Row
If MajJ Then
If .Range("A" & Cpt).Value = CDate(Me.Label115.Caption) Then
IndexJ(1) = .Cells(Cpt, 2).Value
IndexJ(2) = .Cells(Cpt, 3).Value
IndexJ(3) = .Cells(Cpt, 4).Value
IndexJ(4) = .Cells(Cpt, 5).Value
End If
End If
If MajJ_1 Then
If .Range("A" & Cpt).Value < CDate(Me.Label115.Caption) Then
IndexJ_1(1) = .Cells(Cpt, 2).Value
IndexJ_1(2) = .Cells(Cpt, 3).Value
IndexJ_1(3) = .Cells(Cpt, 4).Value
IndexJ_1(4) = .Cells(Cpt, 5).Value
End If
End If
If MajMois Then
If CInt(Year(.Range("A" & Cpt).Value)) = CInt(CDate(Year(Me.Label115.Caption))) And CInt(Month(.Range("A" & Cpt).Value)) = Me.ComboBox1.ListIndex + 1 Then
If IndexMoisInitVide Then
IndexMoisInit(1) = .Cells(Cpt, 2).Value
IndexMoisInit(2) = .Cells(Cpt, 3).Value
IndexMoisInit(3) = .Cells(Cpt, 4).Value
IndexMoisInit(4) = .Cells(Cpt, 4).Value
IndexMoisInitVide = False
End If
IndexMois(1) = .Cells(Cpt, 2).Value
IndexMois(2) = .Cells(Cpt, 3).Value
IndexMois(3) = .Cells(Cpt, 4).Value
IndexMois(4) = .Cells(Cpt, 4).Value
End If
End If
Next Cpt
End With
If MajJ Then
Me.TextBox11.Value = IndexJ(1)
Me.TextBox12.Value = IndexJ(2)
Me.TextBox13.Value = IndexJ(3)
Me.TextBox14.Value = IndexJ(4)
End If
If MajJ_1 Then
Me.TextBox15.Value = IndexJ_1(1)
Me.TextBox16.Value = IndexJ_1(2)
Me.TextBox17.Value = IndexJ_1(3)
Me.TextBox18.Value = IndexJ_1(4)
End If
If MajMois Then
Me.TextBox19.Value = IndexMois(1) - IndexMoisInit(1)
Me.TextBox20.Value = IndexMois(2) - IndexMoisInit(2)
Me.TextBox21.Value = IndexMois(3) - IndexMoisInit(3)
Me.TextBox22.Value = IndexMois(4) - IndexMoisInit(4)
End If
End Sub |
Partager