abréger une parti du macro
Bonjour,
je vous présente mon macro et j'aimerai raccourcir les lignes en bleu car en réalité je possède plus de 200 tableaux donc je vous laisse imaginer la taille du macro!!
si une personne aurai la solution je serai le plus heureux;)
Cordialement jérôme.
Code:
1 2 3
| Sub cherche()
tablo1 = Sheets("Feuil1").Range("B6:F" & Sheets("Feuil1").Range("B65536").End(xlUp).Row)
tablo2 = Sheets("Feuil1").Range("H6:L" & Sheets("Feuil1").Range("H65536").End(xlUp).Row) |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| For Each cel In Sheets("Feuil2").Range("C7:E7")
For n = LBound(tablo1, 1) To UBound(tablo1, 1)
If tablo1(n, 1) = cel.Value Then
tot = tot + tablo1(n, 5)
End If
Next n
For n = LBound(tablo2, 1) To UBound(tablo2, 1)
If tablo2(n, 1) = cel.Value Then
tot = tot + tablo2(n, 5)
End If
Next n
cel.Offset(1, 0) = tot
tot = 0
Next
End Sub |