Private Sub CommandButton1_Click()
Dim cellule As Range, trouve As Range, suite As Range
Set cellule = Range("B2") 'valeur à chercher
Open ActiveWorkbook.Path & "\codes.csv" For Input As #1
Do While Not EOF(1)
Cells.Find(What:="B2", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
If trouve Is Nothing Then 'si pas trouvé
suite.Value = cellule.Value
Else: MsgBox "Code existant", vbInformation, "Attention"
Exit Sub
End If
Range("B2").Copy
End Sub
Exit Sub