Erreur d'exécution 9, l'indice n'appartient pas à la sélecti
m
Bonjour,
J'ai un souci sur une macro Excel. Le but est d'ouvrir un classeur Excel (UEFA_SIGN - MASTER PER SITE_SCOPING POST SV3, feuille "PROD + Pré-renta") et d'en extraire des données sur un autre classeur (Tri DPMT, feuille "Actuel")
Mon programme a marché une fois, et depuis j'ai un message d'erreur "Erreur d'exécution 9, l'indice n'appartient pas à la sélection" avec un surlignement de la ligne qui bloque ci-dessous.
Je ne comprends pas, si quelqu'un pouvait m'aider.. Merci d'avance !
Sub ImporterAttributs()
Dim i As Integer
Dim j As Integer
Application.Workbooks.Open "C:\Users\mnino\Desktop\UEFA_SIGN - MASTER PER SITE_SCOPING POST SV3.xlsx"
For i = 5 To 10
For j = 3 To 3000
If Workbooks("Tri DPMT").Sheets("Actuel").Cells(i, 5).Value = Workbooks("UEFA_SIGN - MASTER PER SITE_SCOPING POST SV3").Sheets("PROD + Pré-renta").Cells(j, 2).Value Then
'Type of Products
Workbooks("UEFA_SIGN - MASTER PER SITE_SCOPING POST SV3").Sheets("PROD + Pré-renta").Activate
Cells(j, 1).Select
Selection.Copy
Workbooks("Tri DPMT").Sheets("Actuel").Activate
Cells(i, 6).Select
ActiveSheet.Paste
'Item Name
Workbooks("UEFA_SIGN - MASTER PER SITE_SCOPING POST SV3").Sheets("PROD + Pré-renta").Activate
Cells(j, 3).Select
Selection.Copy
Workbooks("Tri DPMT").Sheets("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
Bonjour
Sans fichier pour tester pas évident
A tester (sur des copies bien sur)
Sub ImporterAttributs()
Dim i As Integer
Dim j As Integer
Dim F1 As Worksheet
Set F1 = Sheets("Actuel")
With Workbooks.Open("C:\Users\mnino\Desktop\UEFA_SIGN - MASTER PER SITE_SCOPING POST SV3.xlsx")
With .Sheets("PROD + Pré-renta")
For i = 5 To 10
For j = 3 To 3000
If F1.Cells(i, 5).Value = .Cells(j, 2).Value Then
'Type of Products
F1.Cells(i, 6) = .Cells(j, 1)
'Item Name
F1.Cells(i, 7) = .Cells(j, 3)
Exit For
End If
Next j
Next i
End With
.Close savechanges:=False
End With
End Sub