Private Sub UserForm_Initialize()
Dim hwnd As Long, Style As Long, i As Long, NbMois As Long, LstNoms() As String
hwnd = FindWindow(vbNullString, Me.Caption)
Style = GetWindowLong(hwnd, -16) And Not &HC00000
SetWindowLong hwnd, -16, Style
DrawMenuBar hwnd
'Alimentation listbox
Me.ListBox1.Clear
ReDim LstNoms(1 To 3, 1 To 1)
With Sheets("Feuil1") 'Dans la Feuil1
For i = 2 To .Range("A65536").End(xlUp).Row ' De la ligne 2 à la dernière ligne remplie colonne A
NbMois = DateDiff("m", .Cells(i, 3).Value, Date, vbMonday, vbFirstFourDays) + (Day(Date) < Day(.Cells(i, 3).Value))
'Calcul du nombre de mois entre la date du jour et la date colonne C
If NbMois < 8 Then
'Si le nombre de mois est inférieur à 8, on alimente un tableau (LstNoms) avec les données de la ligne
If LstNoms(1, 1) <> "" Then ReDim Preserve LstNoms(1 To 3, 1 To UBound(LstNoms, 2) + 1)
'On agrandit le tableau pour accueillir les nouvelles données
LstNoms(1, UBound(LstNoms, 2)) = .Cells(i, 1).Value
LstNoms(2, UBound(LstNoms, 2)) = .Cells(i, 2).Value
LstNoms(3, UBound(LstNoms, 2)) = Format(.Cells(i, 3).Value, "DD/MM/YYYY")
'On remplit la nouvelle "ligne" du tableau
End If
Next i
Me.ListBox1.Column = LstNoms 'On utilise le tableau LstNoms pour alimenter la listbox
End With
End Sub