1 pièce(s) jointe(s)
pb listview références introuvables
Bonjour,
J'ai un petit problème concernant un fichier excel. j'ai mis excel 2003 comme titre du sujet mais j'aimerais aussi qu'il fonctionne sous 2010.. merci d'avance
J'ai un USF qui contient une listview. Il récupère bien les valeurs mais pas toutes et je ne sais pas pourquoi.
Le fichier joint en excel sera plus clair.
1) Lancer la macro loadUSF
2) Taper 41554 par exemple ou 42042 (toute les références qui n'ont pas le petit encadré rouge an haut à gauche de la cellule
3) la référence est présente dans mon tableau mais n'apparait pas dans ma listview
Je penses avoir localiser le pb qu iest du surement au format cellule. Le problème c'est que quand il n'y a pas le petit carré rouge avec amrquer nombre stocké sous forme de texte, la référence ne semble pas s'ajouter au dico...
J'ai donc pensé a mettre un macro pour mettre toute les cellule au format texte mais en vain... même quand je mets la cellule au format texte, le problème persiste...
Savez-vous comment faire svp
J'espère avoir été assez clair :S
Ci-joint le fichier en question...
je vous mets le code du listview aussi peut être que cela peut jouer ?
Code:
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
| Private Sub UserForm_Initialize()
Dim k As Byte
For k = 1 To 5
Remplissage Me.Controls("C" & k), k
Next k
End Sub
Private Sub Remplissage(ByVal Cmb As Object, ByVal Col As Integer)
Dim Fin As Long, i As Long
Dim MonDico As Object
Dim AA
With Worksheets("Appro")
.AutoFilterMode = False
Fin = .Cells(.Rows.Count, 1).End(xlUp).Row
AA = .Range("A2:AH" & Fin)
End With
Set MonDico = CreateObject("Scripting.Dictionary")
For i = 1 To UBound(AA, 1)
If AA(i, Col) <> "" Then
If Not MonDico.Exists(AA(i, Col)) Then MonDico.Add AA(i, Col), AA(i, Col)
End If
Next i
If MonDico.Count > 0 Then Cmb.List = Application.Transpose(MonDico.Items)
MonDico.RemoveAll
Set MonDico = Nothing
End Sub |
ou alors cela provient d'ici?
Code:
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
| Option Explicit
Option Base 1
Option Compare Text
Dim a1$, a2$, a3$, a4$, a5$
Private Sub C1_Change() ' Combobox n° PR de l'userform dans recherche
If C1 = "" Then C1_Click
End Sub
Private Sub C2_Change() ' Combobox Date exp PR de l'userform dans recherche
If C2 = "" Then C1_Click
End Sub
Private Sub C3_Change() ' Combobox FICHE CONSIGNE de l'userform dans recherche
If C3 = "" Then C1_Click
End Sub
Private Sub C4_Change() ' Combobox date exp FICHE CONSIGNE de l'userform dans recherche
If C4 = "" Then C1_Click
End Sub
Private Sub C5_Change() ' Combobox Référence de l'userform dans recherche
If C5 = "" Then C1_Click
End Sub
Private Sub C1_Click() ' Combobox Entité de l'userform dans recherche
Dim i&, Fin&, y&, a&, AA
Application.ScreenUpdating = 0
If C1 = "" Then a1 = "*" Else a1 = C1
If C2 = "" Then a2 = "*" Else a2 = C2
If C3 = "" Then a3 = "*" Else a3 = C3
If C4 = "" Then a4 = "*" Else a4 = C4
If C5 = "" Then a5 = "*" Else a5 = C5
If a1 = "*" And a2 = "*" And a3 = "*" And a4 = "*" And a5 = "*" Then L1.Clear: Exit Sub
L1.Clear
With Feuil1
y = 2
Fin = .Range("A" & Rows.Count).End(xlUp).Row
AA = .Range("A2:AH" & Fin)
End With
For i = 1 To UBound(AA)
If AA(i, 1) Like a1 And AA(i, 2) Like a2 And AA(i, 3) Like a3 And AA(i, 4) Like a4 And AA(i, 5) Like a5 Then AA(i, 22) = "OUI": y = y + 1
Next i
If y = 1 Then Exit Sub
If y = 2 Then
ReDim bb(1, 2)
For i = 1 To UBound(AA)
If AA(i, 22) = "oui" Then
For a = 1 To 22
bb(1, a) = AA(i, a)
Next a
GoTo 1
End If
1 Next i
Else
ReDim bb(y - 1, UBound(AA, 2) - 1)
y = 1
For i = 1 To UBound(AA)
If AA(i, 22) = "OUI" Then
For a = 1 To 22
bb(y, a) = AA(i, a)
Next a
y = y + 1
End If
Next i
End If
With L1
.ColumnCount = 5 ' nombre de colonnes dans la list box L1
.ColumnWidths = "100;200;100;100;100" 'largeur des champs dans la listbox L1
.List = bb
End With
End Sub |
Merci d'avance pour votre temps accordé au problème!