Sub Spy()
' Spy Macro
' Macro enregistrée le 10/06/2010 par Gruick
Dim c As Range, d As Range
Sheets("export").Activate
[COLOR="Magenta"]k = InputBox("nombre de caractères à comparer")[/COLOR]
For Each c In Range(Cells(2, 2), Cells(2 ^ 16, 2).End(xlUp))
With Sheets("export_org")
For Each d In .Range(.Cells(2, 3), .Cells(2 ^ 16, 3).End(xlUp))
[COLOR="Magenta"]If Left(c, k) = Left(d, k) Then[/COLOR]
MsgBox "Trouvé " & c ' pas obligatoire
c.Offset(0, -1) = d.Offset(0, -1)
c.Offset(0, 16) = d.Offset(0, 9)
c.Offset(0, 1).ClearContents
GoTo suivant
Else
If c.Offset(0, -1) = "" Then c.Offset(0, 1) = "X"
End If
Next
End With
suivant:
Next
End Sub