Bonsoir Forum
Je souhaite chercher une valeur dans la colonne C de la feuille "Contrats" via un TextBox1 d’un USF et afficher la confirmation de la recherche dans un TextBox2.
Example:
Si la valeur saisie dans le TextBox1 existe dans la colonne C de la feuille "Contrats"
alors afficher dans le TextBox2 : Contrat existe
si non : Contrat non inscrit
GRAZIE
Private Sub TextBox1_Change()
TextBox2 = "Contrat " & IIf(Application.CountIf(Range("C2:C" & Rows.Count), TextBox1), "existe", "non inscrit")
End Sub
ou :
Code:
Private Sub TextBox1_Change()
With Sheets("Contrats")
TextBox2 = "Contrat " & IIf(Application.CountIf(.Range("C2:C" & .Rows.Count), TextBox1), "existe", "non inscrit")
End With
End Sub
Private Sub TextBox1_Change()
TextBox2 = "Contrat " & IIf(Application.CountIf(Range("C2:C" & Rows.Count), TextBox1), "existe", "non inscrit")
End Sub
ou :
Code:
Private Sub TextBox1_Change()
With Sheets("Contrats")
TextBox2 = "Contrat " & IIf(Application.CountIf(.Range("C2:C" & .Rows.Count), TextBox1), "existe", "non inscrit")
End With
End Sub
Re
si tu permet j'ai ajouter a ton code (2eme) le code suivant : If TextBox1.Value = "" Then TextBox2.Value = ""
Code:
Private Sub TextBox1_Change()
With Sheets("Contrats")
TextBox2 = "Contrat " & IIf(Application.CountIf(.Range("C2:C" & .Rows.Count), TextBox1), "existe", "non inscrit")
If TextBox1.Value = "" Then TextBox2.Value = ""
End With
End Sub
Assez élémentaire non ?
GRAZIE MAITRE
PBLM RESOLUTO