Sub test()
Dim Plage As Range, Cel As Range
Dim DerniereLigne As Integer
DerniereLigne = Cells(65536, 1).End(xlUp).Row
Feuille = ActiveSheet.Name
Set Plage = Range(Cells(1, 1), Cells(DerniereLigne, 1))
For Each Cel In Plage
If Cel.Value = Worksheets(Feuille).TextBox1.Value Then
MsgBox ("Oui, la valeur cherchée existe")
End If
Next Cel
End Sub
Private Sub CommandButton1_Click()
If Application.CountIf(Range("A1:A10"), TextBox1) >= 1 Then
MsgBox "existe"
Else: MsgBox "n'existe pas"
End If
End Sub
Private Sub txtCoNb_AfterUpdate()
Dim plage As Range, cel As Range
Set plage = Range(Worksheets("Data").Cells(4, 2), Worksheets("Data").Cells(19, 2))
For Each cel In plage
If cel.Value = txtCoNb.Value Then
txtCoName.Value = WorksheetFunction.VLookup(CLng(txtCoNb.Value), Range("ID_Nb_Name"), 2, False)
Else
message8 = " :@:@:@"
MsgBox message8
End If
Next cel
End Sub