extraction entre 2 dates et affichage dans listbox
bonjour le forum et bonne journée
j'ai adapter un code d'extraction de données d'une feuille de calcul entre deux dates via deux textbox et affiché le résultat dans une listbox mais malheureusement je n'arrive pas a alimenter la listbox j'ai essayé tout les propriétés (Additem,List,Rowsource) et ça coince justement a ce niveau voici le code que j'ai adapter :
Code:
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
| Private Sub cbtOK_Click()
Dim tableau()
Dim i As Integer
Dim c As Variant
i = 0
If Me.tbxStart <> "" And Me.tbxEnd <> "" Then
'** ajouter des vérifications sur la "validité" des dates renseignées serait utile
With Sheets("TPor")
For Each c In .Range("A2:A" & .Range("A65000").End(xlUp).Row)
If c.Value >= CDate(tbxStart) And c.Value <= CDate(tbxEnd) Then
ReDim Preserve tableau(i + 1)
tableau(i) = .Range("a" & c.Row & ":" & "I" & c.Row).Value
i = i + 1
End If
Next c
End With
With Me.ListBox1
ListBox1.Clear
For i = 0 To UBound(tableau)
ListBox1.AddItem tableau(i)
Next i
End With
End If
Me.Hide
End Sub
Private Sub tbxEnd_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
If Not IsDate(tbxEnd) Then MsgBox "Veuillez entrer Une Date Svp": tbxEnd = "": Exit Sub
Fin = CDate(tbxEnd)
End Sub
Private Sub tbxStart_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
If Not IsDate(tbxStart) Then MsgBox "Veuillez entrer Une Date Svp": tbxStart = "": Exit Sub
Start = CDate(tbxStart)
End Sub |
merci d'avance pour vos réponses et bonne journée mesdames et messieurs