Sub MAJ_Source()
Application.ScreenUpdating = False
'------------------------------------------
' Définition des variables
'------------------------------------------
Dim xIdx As Integer 'Définition variable Index
Dim xGac As String 'Définition variable Gac
Dim xHis As String 'Définition variable Historique
Dim xDerLig As Integer 'Définition variable Dernière ligne
Dim F As Integer 'Définition variable F (boucle)
Dim xResult As Integer 'Définition variable xResult
'------------------------------------------
' Suite
'------------------------------------------
With Sheets("Extract Achat") 'On travaille sur l'onglet Extract Achat
xDerLig = .Range("BE1000").End(xlUp).Row 'On récupère la denière ligne saisie
For F = 1 To xDerLig 'Boucle de la ligne 1 à dernière ligne
xIdx = .Range("BE" & F + 7) 'On affecte à xIdx l'index (Colonne BE)
xGac = .Range("E" & F + 7) 'On affecte à xGac le GAC (Colonne E)
xHis = .Range("BA" & F + 7) 'On affecte à xHis l'historique (Colonne BA)
If xIdx <> 0 Then
With Sheets("Source") 'On travaille sur l'onglet Source
On Error GoTo PasTrouve 'Si on ne trouve pas de correspondance, on va à PasTrouve:
xResult = Application.Match(xIdx, .Range("M2:M1000"), 0) 'On affecte à xResult
If xResult > 0 Then 'Si résultat positif
.Range("H" & 1 + xResult) = xGac 'On sincrit en colonne H le résultat de xGac
.Range("I" & 1 + xResult) = xHis 'On inscrit en colonne I le résultat de xHis
End If 'Fin Si
End With 'Fin travail sur onglet Source
End If
PasTrouve: 'Etiquette PasTrouve
Next F 'Fin boucle
End With 'Fin travail sur onglet Extract Achat
MsgBox "Traitement terminé", vbInformation, "DONNES DANS SOURCE"
Application.ScreenUpdating = True
End Sub