Recherche IF OR dans userform

bonjour tous le mondes,

Je n'arrive pas à utiliser la condition "OR" dans ce code

Mon but, est de pouvoir faire une recherche par n° de client ou nom.

Pour l'instant, la recherche ne fonctionne que par le nom!

Private Sub CommandButton5_Click()
If Not (ComboBox1.Value = "" Or ComboBox2.Value = "") Then
Dim no_ligne As Integer
no_ligne = ComboBox1.ListIndex + 4
no_ligne = ComboBox2.ListIndex + 4
ComboBox1.Value = Cells(no_ligne, 1).Value
ComboBox2.Value = Cells(no_ligne, 2).Value
TextBox_prenom.Value = Cells(no_ligne, 3).Value
TextBox_mail.Value = Cells(no_ligne, 18).Value
TextBox_annif.Value = Cells(no_ligne, 17).Value
TextBox_phone.Value = Cells(no_ligne, 16).Value
TextBox_societe.Value = Cells(no_ligne, 5).Value
TextBox_ad1.Value = Cells(no_ligne, 6).Value
TextBox_cp1.Value = Cells(no_ligne, 7).Value
TextBox_ville1.Value = Cells(no_ligne, 8).Value
TextBox_pays1.Value = Cells(no_ligne, 9).Value
TextBox_ad2.Value = Cells(no_ligne, 11).Value
TextBox_cp2.Value = Cells(no_ligne, 12).Value
TextBox_ville2.Value = Cells(no_ligne, 13).Value
TextBox_pays2.Value = Cells(no_ligne, 14).Value
TextBox_infos.Value = Cells(no_ligne, 19).Value
Else
End If
End Sub

j'ai essayé comme ceci, mais ça ne change rien, au contraire, je ne sais plus faire de recherche par "N° de client"

Private Sub CommandButton5_Click()
If Not (ComboBox1.Value = "" Or ComboBox2.Value = "") Then
End If
LectureDonnée
End Sub
---------------------------------------------------------------------------------------------------
Private Sub LectureDonnée()
   With ActiveSheet
Dim no_ligne As Integer
no_ligne = ComboBox1.ListIndex + 4
no_ligne = ComboBox2.ListIndex + 4
TextBox_prenom.Value = Cells(no_ligne, 3).Value
TextBox_mail.Value = Cells(no_ligne, 18).Value
TextBox_annif.Value = Cells(no_ligne, 17).Value
TextBox_phone.Value = Cells(no_ligne, 16).Value
TextBox_societe.Value = Cells(no_ligne, 5).Value
TextBox_ad1.Value = Cells(no_ligne, 6).Value
TextBox_cp1.Value = Cells(no_ligne, 7).Value
TextBox_ville1.Value = Cells(no_ligne, 8).Value
TextBox_pays1.Value = Cells(no_ligne, 9).Value
TextBox_ad2.Value = Cells(no_ligne, 11).Value
TextBox_cp2.Value = Cells(no_ligne, 12).Value
TextBox_ville2.Value = Cells(no_ligne, 13).Value
TextBox_pays2.Value = Cells(no_ligne, 14).Value
TextBox_infos.Value = Cells(no_ligne, 19).Value
End With
End Sub
3boutiquev5.xlsm (189.58 Ko)

Bonjour,

Teste comme ceci, j'ai ôté le bouton "Chercher"

9boutiquev5.xlsm (193.60 Ko)

Bonjour M12,

Je te remercie c'est top

Mais malgré tout je ne comprend toujours pas pourquoi le "or" ne fonctionnait pas?

Car j'ai cherché sur "google" et sur le forum et toutes les explications me ramenais à ce que j'ai fais, ou alors j'ai raté une info qlq part?!

Ce qui ne m’étonnerais pas de ma part

Rechercher des sujets similaires à "recherche userform"