bonjour damien,Pierre-Jean
ajouter 2 listbox pour choix date existante dans la feuille
j'essaye de poster le fichier,mais problème,pourquoi?
j'aimerais avoir des réactions,savoir si d'autres ont aussi des problèmes
Private Sub ListBox2_Change()
TheDate = CDate(ListBox2.Value)
End Sub
Private Sub ListBox3_Change()
If CDate(ListBox3) <= TheDate Then
MsgBox 'une date plus grande que ' & TheDate
Exit Sub
End If
inilb1
End Sub
Private Sub UserForm_Initialize()
Dim C As Range ', y, a As Long
Dim Cola As Collection, Item As Variant
Set Cola = New Collection
For Each C In Feuil1.Range('a1:a' & Range('A65536').End(xlUp).Row)
On Error Resume Next
Cola.Add CStr(C), CStr(C)
On Error GoTo 0
Next C
For Each Item In Cola
ListBox2.AddItem Item
ListBox3.AddItem Item
Next Item
Set Cola = Nothing
End Sub
Sub inilb1()
Dim C As Range
'If Not IsDate(ListBox1) Or Not IsDate(ListBox2) Then Exit Sub
With ListBox1
.Clear
.ColumnCount = 4
.ColumnWidths = '140;90;40;180' ';20
'.ColumnHeads = True
'x = 0
For Each C In Feuil1.Range('a1:a' & Range('A65536').End(xlUp).Row)
If C = CDate(ListBox2) Then
'y = C.Row
.AddItem Cells(C.Row, 20) 'colonne 0
.List(.ListCount - 1, 1) = Cells(C.Row, 1).Text 'colonne 1
.List(.ListCount - 1, 2) = Cells(C.Row, 2).Text 'colonne 2
.List(.ListCount - 1, 3) = Cells(C.Row, 3).Text 'colonne 3
.List(.ListCount - 1, 4) = C.Row
'.List(.ListCount - 1, 4) = x
'x = x + 1
End If
Next C
End With
End Sub