Sub MAJ()
On Error GoTo Fin
' Cr donne le N° de colonne à copier
' Cw le N° de colonne où il faut coller
Cr = Array(2, 3, 4, 8, 11, 15, 19, 22, 25, 29, 33, 37)
Cw = Array(2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23)
' Dernière ligne à traiter
DerLig = 4 + Application.WorksheetFunction.CountA(Range("A4:A1000"))
For L = 4 To DerLig
IndexW = Application.Match(Cells(L, 1), Sheets("Feuil1").Range("A:A"), 0)
For c = 0 To UBound(Cr)
Sheets("Feuil1").Cells(IndexW, Cw(c)) = Cells(L, Cr(c))
Next c
For c = 4 To 24 Step 4
Sheets("Feuil1").Cells(IndexW, c) = Sheets("Feuil1").Cells(IndexW, c - 2) - Sheets("Feuil1").Cells(IndexW, c - 1)
Sheets("Feuil1").Cells(IndexW, c + 1) = Sheets("Feuil1").Cells(IndexW, c) / Sheets("Feuil1").Cells(IndexW, c - 2)
Next c
Next L
Fin:
End Sub
Merci beaucoup de votre réponse bonne journée à vousBonjour Gothc, JHA,
Un essai en PJ.
La mise à jour se fait par appui sur GO.
Toutes les lignes dans Info sont traitées.
Par la même occasion j'ai supprimé toutes les formules en Feuil1 et calculais en macro.
VB:Sub MAJ() On Error GoTo Fin ' Cr donne le N° de colonne à copier ' Cw le N° de colonne où il faut coller Cr = Array(2, 3, 4, 8, 11, 15, 19, 22, 25, 29, 33, 37) Cw = Array(2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23) ' Dernière ligne à traiter DerLig = 4 + Application.WorksheetFunction.CountA(Range("A4:A1000")) For L = 4 To DerLig IndexW = Application.Match(Cells(L, 1), Sheets("Feuil1").Range("A:A"), 0) For c = 0 To UBound(Cr) Sheets("Feuil1").Cells(IndexW, Cw(c)) = Cells(L, Cr(c)) Next c For c = 4 To 24 Step 4 Sheets("Feuil1").Cells(IndexW, c) = Sheets("Feuil1").Cells(IndexW, c - 2) - Sheets("Feuil1").Cells(IndexW, c - 1) Sheets("Feuil1").Cells(IndexW, c + 1) = Sheets("Feuil1").Cells(IndexW, c) / Sheets("Feuil1").Cells(IndexW, c - 2) Next c Next L Fin: End Sub