Bonjour,
J'avoue manquer beaucoup d'expertise en le domaine ...
Mais quand même > je propose quelques corrections ...
En espérant que cela va améliorer un tantinet la chose ...
Option Base 1
Public aa
Private Sub UserForm_Activate()
Me.MultiPage1.Value = 2
End Sub
Private Sub UserForm_Initialize()
Dim i&, bb, cc, Y&, a&, u As Long
ListBox1.Clear
ListBox2.Clear
ListBox3.Clear
ListBox1.ColumnWidths = "70;75;150;100;00;00;00;00"
ListBox2.ColumnWidths = "67;65;150;90;00;00;00;00;90;00;00;00"
ListBox3.ColumnWidths = "85;83;55;155;80;80;30;00"
With ThisWorkbook.Worksheets("Feuil1")
aa = .Range("A2:M" & .Range("A" & .Rows.Count).End(xlUp).Row)
End With
Y = 1
ReDim bb(13, Y)
For i = 1 To UBound(aa)
If aa(i, 7) = "X" Then
If aa(i, 9) <> "" Then
If aa(i, 6) <> "M2" Then
If aa(i, 8) <> "160" Then
If aa(i, 8) <> "161" Then
If aa(i, 4) >= CDate("01/01/2020") Then
If aa(i, 4) <= CDate("31/12/2020") Then
If aa(i, 13) = "" Then
If IsError(aa(i, 1)) Then GoTo 1
ReDim Preserve bb(13, Y)
For a = 1 To 13
bb(a, Y) = aa(i, a)
Next a
Y = Y + 1
End If
End If
End If
End If
End If
End If
End If
End If
1 Next i
ReDim cc(UBound(bb, 2), UBound(bb))
For i = 1 To UBound(bb, 2)
For a = 1 To UBound(bb)
cc(i, a) = bb(a, i)
Next a
Next i
With ListBox1
.List = cc
End With
Y = 1
ReDim bb(13, Y)
For i = 1 To UBound(aa)
If aa(i, 7) = "X" Then
If aa(i, 9) <> "" Then
If aa(i, 6) <> "M2" Then
If aa(i, 8) <> "160" Then
If aa(i, 8) <> "161" Then
If aa(i, 4) >= CDate("1 / 1 / 2020") Then
If aa(i, 4) <= CDate("31 / 12 / 2020") Then
If aa(i, 13) <> "" Then
If IsError(aa(i, 1)) Then GoTo 2
ReDim Preserve bb(13, Y)
For a = 1 To 13
bb(a, Y) = aa(i, a)
Next a
Y = Y + 1
End If
End If
End If
End If
End If
End If
End If
End If
2 Next i
ReDim cc(UBound(bb, 2), UBound(bb))
For i = 1 To UBound(bb, 2)
For a = 1 To UBound(bb)
cc(i, a) = bb(a, i)
Next a
Next i
With ListBox2
.List = cc
End With
With ThisWorkbook.Worksheets("H1")
u = .Cells(.Rows.Count, "A").End(xlUp).Row '''Or .Cells(.Rows.Count, "B").End(xlUp).Row
ListBox3.List = .Range("A2:G" & u).Value
End With
Erase aa
Erase bb
Erase cc
End Sub
ric