Bonjour à tous,
J'ai un souci sur une macro Excel. Je travaille sur deux classeurs différents, un étant le ficher que je modifie (Tri) et l'autre étant mon fichier source (Scope). Je souhaite copier des données situées dans la feuille Scopelist du fichier Scope pour les copier dans la feuille Actuel du fichier Tri.
La macro me dit qu'il y a une bug au niveau de la ligne surlignée, je n'arrive pas à comprendre pourquoi..
Si quelqu'un pouvait m'aider ! Merci d'avance !
Sub ImporterAttributs()
Dim Tri As Workbook
Dim Scope As Workbook
Dim Actuel As Worksheet
Dim ScopeList As Worksheet
Dim i As Integer
Dim j As Integer
Dim LastRowA As Integer
Dim LastRowS As Integer
Set Tri = ActiveWorkbook
Set Scope = Workbooks.Open(Application.GetOpenFilename)
'Tri.Activate
Set Actuel = Tri.Sheets("Actuel")
'Scope.Activate
Set ScopeList = Scope.Sheets("PROD + Pré-renta")
Tri.Activate
LastRowA = Tri.Actuel.Range("A65536").End(xlUp).Row
Scope.Activate
LastRowS = Scope.ScopeList.Range("A65536").End(xlUp).Row
For i = 5 To LastRowA + 4
For j = 3 To LastRowS + 2
If Tri.Actuel.Cells(i, 5).Value = Scope.ScopeList.Cells(j, 2).Value Then
'Type of Products
Scope.ScopeList.Activate
Cells(j, 1).Select
Selection.Copy
Tri.Actuel.Activate
Cells(i, 6).Select
ActiveSheet.Paste
'Item Name
Scope.ScopeList.Activate
Cells(j, 3).Select
Selection.Copy
Tri.Actuel.Activate
Cells(i, 7).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Exit For
End If
Next j
Next i
End Sub