Bonjour à tous,
J'utilise un code (de Boisgontier je crois !) pour faire une recherche intuitive.
le voici :
Me.ListBox1.Clear
i = 0
NbCol = [MaBD].Columns.Count
Set plage = [MaBD].Resize(, 1)
Set c = plage.Find(Me.TextBox1, , , xlPart)
If Not c Is Nothing Then
premier = c.Address
Do
Me.ListBox1.AddItem
lig = c.Row - plage.Row + 1
For col = 1 To NbCol
Me.ListBox1.List(i, col - 1) = plage.Cells(lig, col)
Next col
i = i + 1
Set c = plage.FindNext(c)
Loop While Not c Is Nothing And c.Address <> premier
End If
If Me.ListBox1.ListCount = 0 Then
If MsgBox("Créer une nouvelle reférence ?", vbYesNo) = vbYes Then
UserForm1.Show
Else
Feuil1.liste
End If
End If
Ce code me permet de faire une recherche sur la premiere colonne
Comment faire pour avoir le choix dns la colonne de recherche ?
colonne1 > reference
colonne2 designation
Je pense à 2 optionbutton pour specifier le choix ...
Merci d'avance
nicko
J'utilise un code (de Boisgontier je crois !) pour faire une recherche intuitive.
le voici :
Me.ListBox1.Clear
i = 0
NbCol = [MaBD].Columns.Count
Set plage = [MaBD].Resize(, 1)
Set c = plage.Find(Me.TextBox1, , , xlPart)
If Not c Is Nothing Then
premier = c.Address
Do
Me.ListBox1.AddItem
lig = c.Row - plage.Row + 1
For col = 1 To NbCol
Me.ListBox1.List(i, col - 1) = plage.Cells(lig, col)
Next col
i = i + 1
Set c = plage.FindNext(c)
Loop While Not c Is Nothing And c.Address <> premier
End If
If Me.ListBox1.ListCount = 0 Then
If MsgBox("Créer une nouvelle reférence ?", vbYesNo) = vbYes Then
UserForm1.Show
Else
Feuil1.liste
End If
End If
Ce code me permet de faire une recherche sur la premiere colonne
Comment faire pour avoir le choix dns la colonne de recherche ?
colonne1 > reference
colonne2 designation
Je pense à 2 optionbutton pour specifier le choix ...
Merci d'avance
nicko