1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| Sub Macro3()
0
Dim CIN As Long
Dim TotalRbtCcp As Double
Dim nb_lignes As Long
Dim numero_ligne As Long
Sheets("List Al Ech").Select
nb_lignes = WorksheetFunction.CountA(Range("A:A"))
For i = 2 To nb_lignes
numero_ligne = i
If numero_ligne >= 2 And numero_ligne <= nb_lignes Then
CIN = Cells(numero_ligne, 1)
TotalRbtCcp = 0
Dim Found As Range
Dim Indice As Long
MsgBox TotalRbtCcp
With Worksheets("Rbt CCP")
Set Found = .Range("F2:F12000").Find(CIN, LookIn:=xlValues, LookAt:=xlWhole)
If Not Found Is Nothing Then
Indice = Found.Row
TotalRbtCcp = TotalRbtCcp + Cells(Indice, 2)
MsgBox TotalRbtCcp
End If
End With
Cells(numero_ligne, 9) = TotalRbtCcp
End If
Next
End Sub |
Partager