J'ai un problème sur la ligne
c
Option Explicit
Dim i As Integer, RT(), T As String, Clrt As Integer
Sub afficher_list()
RT = Feuil1.Range("A2:G" & Feuil1.[A65000].End(xlUp).Row)
With userform1.ListBox2
.ColumnWidths = "35;0;0;0;50;50;50"
.ColumnCount = 7
.List = RT
For i = 1 To UBound(RT)
RT(i, 1) = Format(RT(i, 1), "0 ##")
RT(i, 4) = Format(RT(i, 4), "0 ##")
RT(i, 5) = Format(RT(i, 5), "dd/mm/yyyy")
Next i
.List = RT
End With
End Sub
Sub filtrer_list()
Dim j As Integer, Tbl(), k As Integer
RT = Feuil1.Range("A2:G" & Feuil1.[A65000].End(xlUp).Row)
With userform1
T = .TextBox12
Clrt = Application.Match(.ComboBox3, Application.Index(RT, 1), 0)*******************************************
With .ListBox2
For i = 2 To UBound(RT)
If UCase(Left(RT(i, Clrt), Len(T))) Like T Then
j = j + 1
ReDim Preserve Tbl(1 To UBound(RT, 2), 1 To j)
For k = 1 To 7
Tbl(k, j) = RT(i, k)
RT(i, 1) = Format(RT(i, 1), "0 ##")
RT(i, 4) = Format(RT(i, 4), "0 ##")
RT(i, 5) = Format(RT(i, 5), "dd/mm/yyyy")
Next k
End If
Next i
If j <> 0 Then .Column = Tbl Else .Clear
End With
End With
End Subc
j'ai un problème à cette ligne
Clrt = Application.Match(.ComboBox3, Application.Index(RT, 1), 0)
ou est le problème
svp
re,
Clrt = Application.Match(.ComboBox3, RT.rows(1), 0)
mais y-a-t-il toujours un match ? sinon la déclaration doit changer, parce que à ce moment Clrt n'est plus toujours integer.
Dim i As Integer, RT(), T As String, Clrt As Integer
Option Explicit
Dim i As Integer, RT(), T As String, Clrt As Variant
Sub afficher_list()
RT = Feuil1.Range("A2:G" & Feuil1.[A65000].End(xlUp).Row)
With userform1.ListBox2
.ColumnWidths = "35;0;0;0;50;50;50"
.ColumnCount = 7
.List = RT
For i = 1 To UBound(RT)
RT(i, 1) = Format(RT(i, 1), "0 ##")
RT(i, 4) = Format(RT(i, 4), "0 ##")
RT(i, 5) = Format(RT(i, 5), "dd/mm/yyyy")
Next i
.List = RT
End With
End Sub
Sub filtrer_list()
Dim j As Integer, Tbl(), k As Integer
RT = Feuil1.Range("A2:G" & Feuil1.[A65000].End(xlUp).Row)
With userform1
T = .TextBox12
Clrt = Application.Match(.ComboBox3, RT.Rows(1), 0) '*******************************************
If Not IsNumeric(Clrt) Then MsgBox "introuvable", vbCritical: Exit Sub
With .ListBox2
For i = 2 To UBound(RT)
If UCase(Left(RT(i, Clrt), Len(T))) Like T Then
j = j + 1
ReDim Preserve Tbl(1 To UBound(RT, 2), 1 To j)
For k = 1 To 7
Tbl(k, j) = RT(i, k)
RT(i, 1) = Format(RT(i, 1), "0 ##")
RT(i, 4) = Format(RT(i, 4), "0 ##")
RT(i, 5) = Format(RT(i, 5), "dd/mm/yyyy")
Next k
End If
Next i
If j <> 0 Then .Column = Tbl Else .Clear
End With
End With
End Subc
Merci mon ami
c'est super