1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Sub somessence()
Dim nomf As String
Dim ligne As Integer
Dim f As String
Dim ligne2 As Integer
Dim total As Integer
nomf = ("Véhicule" & Sheets("Menu").Cells(10, "D"))
ligne = 5
f = "essence"
ligne2 = 5
Do While Sheets(nomf).Cells(ligne, "A") <> ""
If Sheets(nomf).Cells(ligne, "C") = f Then
total = ligne2 + Sheets(nomf).Cells(ligne, "D")
End If
ligne = ligne + 1
ligne2 = ligne2 + 1
Loop
dat = Sheets(nomf).Cells(ligne, "A")
Sheets("Menu").Cells(15, "D") = dat
End Sub |
Partager