'********************************************************
' *
' /!\ C'est ici que ça prend du temps ! /!\ *
' *
' ( code ci-dessous ) *
' *
'********************************************************
Dim TabTemp() As Variant
Dim TabTemp2() As Variant
With Sheets("Temp")
LastLine = .Range("A" & .Rows.Count).End(xlUp).Row
TabTemp = .Range("A1:E" & LastLine).Value
End With
With Sheets("Temp2")
LastLine = .Range("A" & .Rows.Count).End(xlUp).Row
TabTemp2 = .Range("A1:D" & LastLine).Value
End With
If UBound(TabTemp, 1) > 1 Then
Application.EnableEvents = False
Me.TextBox1.Visible = True 'affichage du compteur
For i = 2 To UBound(TabTemp, 1) 'pour chaque ligne de temp
Me.TextBox1 = i & " / " & UBound(TabTemp, 1) 'Maj Compteur
DoEvents
If UBound(TabTemp2, 1) > 1 Then
For j = LBound(TabTemp2, 1) To UBound(TabTemp2, 1) 'pour chaque ligne de temp2
If TabTemp(i, 5) = "" Then TabTemp(i, 5) = 0
If TabTemp(i, 1) = TabTemp2(j, 1) And TabTemp(i, 2) = TabTemp2(j, 2) Then
If TabTemp(i, 3) = "" Or TabTemp(i, 3) < TabTemp2(j, 4) Then
TabTemp(i, 3) = TabTemp2(j, 4)
TabTemp(i, 5) = TabTemp2(j, 3)
If TabTemp2(j, 3) = "" Or TabTemp2(j, 3) < 0 Then
TabTemp(i, 4) = "Invalid"
Else
TabTemp(i, 4) = "Valid"
End If
End If
Else
If TabTemp(i, 3) = "" Then TabTemp(i, 4) = "Invalid"
End If
Next j
Else
If TabTemp(i, 3) = "" Then TabTemp(i, 4) = "Invalid"
End If
'Worksheets("Command").Cells(30, 13).Value = ((i - 1) / (UBound(TabTemp, 1) - 1)) * 100 'ca sert à quoi?
Next i
Export_Training.TextBox1.Visible = False
Application.EnableEvents = True
End If
Sheets("Temp").Range("A1").Resize(UBound(TabTemp, 1), UBound(TabTemp, 2)) = TabTemp
Sheets("Temp2").Range("A1").Resize(UBound(TabTemp2, 1), UBound(TabTemp2, 2)) = TabTemp2
'********************************************************
' *
' ( code ci-dessus ) *
' *
' /!\ C'est ici que ça prend du temps ! /!\ *
' *
'********************************************************