Re : Besoin d'un coup de main pour une macro
Bonjour,
Grâce à vos indications j'ai pu monter une macro bien utile pour mes collègues. Un dernier détail coince : la macro bug à la ligne en rouge (voir en bas), sans raison apparente..
Auriez-vous une idée de ce qui ne va pas ?
Sub Littérature()
' Littérature Macro
'Afficher_le_titre_la_collection_l'_auteur_en_fonction_du_Gencod APRES MODIF FICHIER FNAC
'Définition des Variables
Dim x$, y$
x = "Ventes et Stocks Magasins"
y = "H:\DC_01\FNAC Data Sharing\Semaines étudiées\[Litté S30.xlsx]"
'Rech V dans S30
Range("G1").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(R1C14, '" & y & x & "'!R4C10:R20000C14,2,0)"
Range("G2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(R1C14, '" & y & x & "'!R4C10:R20000C14,3,0)"
Range("G3").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(R1C14, '" & y & x & "'!R4C10:R20000C114,4,0)"
'***********************************************************************************************************
'Sub Ventes_et_stocks_test()
Dim f$, h&, c As Range, fich$
f = "Ventes et Stocks Magasins"
h = Application.Match("TOTAL", [C:C], 0) - 7 'la hauteur du tableau peut varier
Application.ScreenUpdating = False
Application.DisplayAlerts = False 'si des fichiers n'existent pas
For Each c In Range("E6", Cells(6, Columns.Count).End(xlToLeft))
If c = "Vtes" Then
fich = "H:\DC_01\FNAC Data Sharing\Semaines étudiées\[Litté S" & Val(Replace(c(0, 0), "Semaine", "")) & ".xlsx]"
c(2).Resize(h) = "=IFERROR(VLOOKUP(RC1,'" & fich & f & "'!R4C1:R20000C22,21,0),0)"
c(2, 2).Resize(h) = "=IFERROR(VLOOKUP(RC1,'" & fich & f & "'!R4C1:R20000C22,22,0),0)"
End If
Next
End Sub
Encore merci pour votre aide,
Pino12