Re : Listbox avec plus de 10 colonnes
Re, voici mon code mais cela bug toujours à la 10 ème:
Sub BILANAGREAGE()
Dim reponse As String
'Windows("base peche.xls").Activate
Sheets("BASE").Activate
Dim TheDate As Date ' Déclare les variables.
Dim Msg
Dim c, x As Long
reponse = InputBox("Entrez une date (jj/mm/aaaa)", "Création du bilan agréage du... ")
If IsDate(reponse) Then
TheDate = reponse
UserForm3.Label2 = Date - DateDiff("d", TheDate, Now)
UserForm3.Caption = "Bilan agréage du :" & TheDate
x = 0
For Each n In Worksheets("BASE").Range("a11:a" & Range("A65536").End(xlUp).Row)
If n = UserForm3.Label2 Then
a = n.Row
UserForm3.ListBox1.AddItem Cells(a, 2)
UserForm3.ListBox1.List(x, 1) = Cells(a, 3)
UserForm3.ListBox1.List(x, 2) = Cells(a, 4)
UserForm3.ListBox1.List(x, 3) = Cells(a, 16)
UserForm3.ListBox1.List(x, 4) = Cells(a, 23)
UserForm3.ListBox1.List(x, 5) = Cells(a, 18)
UserForm3.ListBox1.List(x, 6) = Cells(a, 21)
UserForm3.ListBox1.List(x, 7) = Cells(a, 32)
UserForm3.ListBox1.List(x, 8) = Cells(a, 22)
UserForm3.ListBox1.List(x, 9) = Cells(a, 29)
UserForm3.ListBox1.List(x, 10) = Cells(a, 30)
UserForm3.ListBox1.List(x, 11) = Cells(a, 27)
UserForm3.ListBox1.List(x, 12) = Cells(a, 28)
UserForm3.ListBox1.List(x, 13) = Cells(a, 26)
UserForm3.ListBox1.List(x, 14) = Cells(a, 15)
UserForm3.ListBox1.List(x, 15) = Cells(a, 24)
UserForm3.ListBox1.List(x, 16) = Cells(a, 25)
UserForm3.ListBox1.List(x, 17) = Cells(a, 19)
UserForm3.ListBox1.List(x, 18) = Cells(a, 20)
UserForm3.ListBox1.List(x, 19) = Cells(a, 31)
UserForm3.ListBox1.List(x, 20) = Cells(a, 34)
UserForm3.ListBox1.List(x, 21) = Cells(a, 35)
UserForm3.ListBox1.List(x, 22) = Cells(a, 36)
x = x + 1
End If
Next n
If UserForm3.ListBox1.ListCount > 0 Then
UserForm3.Label4.Caption = ""
ElseIf UserForm3.ListBox1.ListCount = 0 Then UserForm3.Label4.Caption = "PAS DE CONTRÔLE CE JOUR"
End If
If UserForm3.Label4.Caption = "PAS DE CONTRÔLE CE JOUR" Then UserForm3.Label4.Visible = True
If UserForm3.Label4.Caption = "PAS DE CONTRÔLE CE JOUR" Then UserForm3.ListBox1.Visible = False
UserForm3.Show
Else
If reponse = "" Then
Exit Sub
Else
MsgBox ("Format date incorrect!")
Call BILANAGREAGE
End If
End If
End Sub
merci
dam