Bonjour le Forum,
J'aurais besoin de votre aide concernant la synthaxe pour créer un tableau temporaire avec les éléments d'une listbox, puis recharger le tableau la même listbox après un tri avec des combobox
Ci dessous un début de code en compilant des extraits tirés sur le forum. Mais j'ai l'erreur 380 (impossible de définir la propriété column. Valeur de propriété non valide)
Merci
Private Sub ComboBox1_Change()
Dim Container As Variant, Item As Variant
Dim TabNumCde() As String
Dim TabGeneral() As Variant
Dim ColListb As Collection
Dim i As Long, h As Long, x As Long, y As Long
Dim c As Byte, cc As Byte
'Me.ListBox1.Clear
Set ColListb = New Collection
For i = 0 To ListBox1.ListCount - 1
ColListb.Add USF1.ListBox1(i, 0) & Chr(35) & USF1.ListBox1(i, 1) & Chr(35) & _
USF1.ListBox1(i, 2) & Chr(35) & USF1.ListBox1(i, 3) & Chr(35) & _
USF1.ListBox1(i, 4) & Chr(35) & USF1.ListBox1(i, 5) & Chr(35) & _
USF1.ListBox1(i, 6) & Chr(35) & USF1.ListBox1(i, 7) & Chr(35) & _
USF1.ListBox1(i, 8) & Chr(35) & USF1.ListBox1(i, 9), _
USF1.ListBox1(i, 0) & Chr(35) & USF1.ListBox1(i, 1) & Chr(35) & _
USF1.ListBox1(i, 2) & Chr(35) & USF1.ListBox1(i, 3) & Chr(35) & _
USF1.ListBox1(i, 4) & Chr(35) & USF1.ListBox1(i, 5) & Chr(35) & _
USF1.ListBox1(i, 6) & Chr(35) & USF1.ListBox1(i, 7) & Chr(35) & _
USF1.ListBox1(i, 8) & Chr(35) & USF1.ListBox1(i, 9)
On Error GoTo 0
Next
For Each Item In ColListb
'ReDim Preserve TabGeneral(10, x)
ReDim TabGeneral(10, x)
Container = Split(Item, Chr(35))
For cc = 0 To 9
TabGeneral(cc, x) = CStr(Container(cc))
Next cc
x = x + 1
Next
' If Me.ComboBox1 = CStr(ColListb(i, 8)) Or Me.ComboBox1 = "Tout" Then
With Me.ListBox1
.ColumnCount = 10
.ColumnWidths = "60;125;60;60;60;55;55;50;70;60"
.Column() = TabGeneral
End With
End Sub
J'aurais besoin de votre aide concernant la synthaxe pour créer un tableau temporaire avec les éléments d'une listbox, puis recharger le tableau la même listbox après un tri avec des combobox
Ci dessous un début de code en compilant des extraits tirés sur le forum. Mais j'ai l'erreur 380 (impossible de définir la propriété column. Valeur de propriété non valide)
Merci
Private Sub ComboBox1_Change()
Dim Container As Variant, Item As Variant
Dim TabNumCde() As String
Dim TabGeneral() As Variant
Dim ColListb As Collection
Dim i As Long, h As Long, x As Long, y As Long
Dim c As Byte, cc As Byte
'Me.ListBox1.Clear
Set ColListb = New Collection
For i = 0 To ListBox1.ListCount - 1
ColListb.Add USF1.ListBox1(i, 0) & Chr(35) & USF1.ListBox1(i, 1) & Chr(35) & _
USF1.ListBox1(i, 2) & Chr(35) & USF1.ListBox1(i, 3) & Chr(35) & _
USF1.ListBox1(i, 4) & Chr(35) & USF1.ListBox1(i, 5) & Chr(35) & _
USF1.ListBox1(i, 6) & Chr(35) & USF1.ListBox1(i, 7) & Chr(35) & _
USF1.ListBox1(i, 8) & Chr(35) & USF1.ListBox1(i, 9), _
USF1.ListBox1(i, 0) & Chr(35) & USF1.ListBox1(i, 1) & Chr(35) & _
USF1.ListBox1(i, 2) & Chr(35) & USF1.ListBox1(i, 3) & Chr(35) & _
USF1.ListBox1(i, 4) & Chr(35) & USF1.ListBox1(i, 5) & Chr(35) & _
USF1.ListBox1(i, 6) & Chr(35) & USF1.ListBox1(i, 7) & Chr(35) & _
USF1.ListBox1(i, 8) & Chr(35) & USF1.ListBox1(i, 9)
On Error GoTo 0
Next
For Each Item In ColListb
'ReDim Preserve TabGeneral(10, x)
ReDim TabGeneral(10, x)
Container = Split(Item, Chr(35))
For cc = 0 To 9
TabGeneral(cc, x) = CStr(Container(cc))
Next cc
x = x + 1
Next
' If Me.ComboBox1 = CStr(ColListb(i, 8)) Or Me.ComboBox1 = "Tout" Then
With Me.ListBox1
.ColumnCount = 10
.ColumnWidths = "60;125;60;60;60;55;55;50;70;60"
.Column() = TabGeneral
End With
End Sub