bonjour,
voilà je suis toujours en développement de mon annuaire téléphonique, malheureusement, j'ai dû rencontré un petit bug d’exécution en changeant les noms des onglets, merci de me donner un cout de pousse en urgence pour finaliser mon travail..
voilà je suis toujours en développement de mon annuaire téléphonique, malheureusement, j'ai dû rencontré un petit bug d’exécution en changeant les noms des onglets, merci de me donner un cout de pousse en urgence pour finaliser mon travail..
Dim tablotemp As Variant
Private Sub CommandButton1_Click()
If TextBox1 <> "" Then Recherche
End Sub
Private Sub Worksheet_Activate()
charger_liste
End Sub
Private Sub charger_liste()
With Sheets("Liste Agents")
tablotemp = .Range("A2:x" & .Range("A65536").End(xlUp).Row).Value
End With
With Sheets("consult_FicheAgent").ListBox1
.ColumnCount = 24 'calibre la listBox 1 à colonnes de 0 à 5
.ColumnWidths = "40;80;90;80;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0"
.List = tablotemp
End With
End Sub
Private Sub ListBox1_Click()
With Sheets("consult_FicheAgent")
.Range("consult_FicheAgent") = tablotemp(Sheets("consult_FicheAgent").ListBox1.ListIndex + 1, 1)
End With
End Sub
Private Sub Recherche() 'au changement dans la TextBox1
'Dim c As Range 'déclare la variable c
'Dim pa As String 'déclare la variable pa
'Dim X As Integer 'déclare la variable x
'
'Set f = Sheets("Liste Agents") 'définit la variable f
'lf = f.Range("A65536").End(xlUp).Row 'définit la variable lf
'Set deux = f.Range("A2" & lf) 'définit la variable deux
'
'
'ListBox1.Clear 'vide la ListBox1
'X = 0 'définit la variable x
'
'With deux 'prend en compte la plage deux
' Set c = .Find(TextBox1.Value, Range("A2"), xlValues, xlPart) 'définit la variable c (=chercher : ctrl F)
'
' If Not c Is Nothing Then 'condition 1 : si c existe
' pa = c.Address 'définit la variable pa (premmière adressse de c)
' Do 'éxécute
' ' If c.Column = 1 Then 'condition 2 : si la colonne de c est 1
' ListBox1.AddItem c.Row 'ajoute la valeur de c à la ListBox1 (colonne 0)
' ListBox1.Column(1, X) = c.Offset(0, 1).Value 'ajoute la valeur de la cellule à droite de c (colonne1)
' X = X + 1 'redéfinit la variaqble x
' Set c = .FindNext(c) 'redéfinit la variable c (prochaine occurence)
'
' Loop While Not c Is Nothing And c.Address <> pa 'boucle tant que l'adresse de c est différente de pa
' End If 'fin de la condition 1
'
'End With 'fin de la prise en compte de la plage deux
Dim PremCel As String, Tbl() As Variant
Dim Cel As Range, I As Integer, L As Integer, Li As Integer
With Sheets("Liste Agents").Range("A1" & Sheets("Liste Agents").Range("A65536").End(xlUp).Row)
Set Cel = .Find(TextBox1)
If Not Cel Is Nothing Then
PremCel = Cel.Address
Do
If Cel.Row > 1 Then
'code client
If IsNumeric(TextBox1) And Cel.Column = 1 Then
I = I + 1
ReDim Preserve Tbl(1 To I)
Tbl(I) = Cel.Row
End If
'nom ou prénom
If Not IsNumeric(TextBox1) And Cel.Column = 3 Or Cel.Column = 4 Then
I = I + 1
ReDim Preserve Tbl(1 To I)
Tbl(I) = Cel.Row
End If
End If
Set Cel = .FindNext(Cel)
Loop Until Cel.Address = PremCel
End If
End With
If I = 0 Then Exit Sub
With Sheets("Liste Agents")
tablotemp = .Range("A2:x" & .Range("A65536").End(xlUp).Row).Value
End With
With Sheets("consult_FicheAgent").ListBox1
.Clear
.ColumnCount = 24 'calibre la listBox1 à 24 colonnes de 0 à 24-1(ColumnCount-1)
.ColumnWidths = "40;80;90;80;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0"
For L = 1 To UBound(Tbl)
For Li = 1 To UBound(tablotemp, 1)
If Li = Tbl(L) - 1 Then
.AddItem tablotemp(Li, 1)
For c = 2 To UBound(tablotemp, 2)
.List(.ListCount - 1, c - 1) = tablotemp(Li, c)
Next c
End If
Next Li
Next L
End With
'End If
End Sub