Bonjour,
J'ai crée une macro permettant, si un compte fournisseur est impacté, si l'achat concerne un compte de dossier technique de me récupérer le n°dossier, sinon de classer en frais généraux.
Voici donc le code :
Const d As Integer = 6
Const titreJNL As Integer = 6
Dim Lastlig As Long
Dim Lastcol As Long
Dim wsh1 As Worksheet
Set wsh1 = res.Worksheets("JNL ACH")
With wsh1
Lastcol = .Cells(titreJNL, Columns.Count).End(xlToLeft).Column
Lastlig = .Cells(Rows.Count, Lastcol).End(xlUp).Row
For i = 6 To Lastlig
If .Cells(i, d).Value = 401100 Or .Cells(i, d).Value = 401000 Then
If Not .Cells(i, d).CurrentRegion.Find("604", LookAt:=xlPart) Is Nothing Then
.Cells(i, Lastcol + 1).Value = .Cells(i, d + 1).Value
End If
If .Cells(i, d).CurrentRegion.Find("604", LookAt:=xlPart) Is Nothing Then
.Cells(i, Lastcol + 1).Value = "FGX"
End If
End If
Next i
End With
End Sub
Problème, vous pourrez tester vous-même avec le fichier test anonymisé, parfois la méthode Find fonctionne, d'autre fois elle considère avoir trouvé un compte 604. alors que non!!!
Aussi je vous demande de l'aide, merci!