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 36 37 38 39 40 41 42 43
|
Private Sub UserForm_Activate()
Dim i As Long
Dim X As Integer, DerniereLigne As Integer
'Sheets("data_global").Select
'On récupère la dernière ligne de la source de données
If Sheets("data_CD05").Cells(Rows.Count, 1).End(xlUp).Row = 1 Then
DerniereLigne = 2
Else
DerniereLigne = Sheets("data_CD05").Cells(Rows.Count, 1).End(xlUp).Row
End If
ListBox1.Clear
'On définit la dimension de nos colonnes
With Me.ListBox1
'taille de la police par defaut à 8
.FontSize = 10
.ColumnHeads = False
.ColumnWidths = "15;30;120;120;120;120;120;100;100;100;120;0"
.ColumnCount = 12
.ListStyle = 1
.MultiSelect = 1
End With
'On alimente la list box avec les données qui nous intéressent
For X = 1 To DerniereLigne
If Left(Sheets("data_CD05").Cells(X, 2), 7) = "Demande" Then
Me.ListBox1.AddItem Sheets("data_CD05").Cells(X, 1)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1) = Sheets("data_CD05").Cells(X, 4)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 2) = Sheets("data_CD05").Cells(X, 11)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 3) = Sheets("data_CD05").Cells(X, 12)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 4) = Sheets("data_CD05").Cells(X, 5)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 5) = Sheets("data_CD05").Cells(X, 6)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 6) = Sheets("data_CD05").Cells(X, 8)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 7) = Sheets("data_CD05").Cells(X, 9)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 8) = Sheets("data_CD05").Cells(X, 10)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 9) = " "
' Me.ListBox1.List(Me.ListBox1.ListCount - 1, 10) = Sheets("data_CD05").Cells(X, 3)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 11) = " "
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 12) = Sheets("data_CD05").Cells(X, 3)
End If
Next X |
Partager