Bonjour,
J'ai écris un code afin de calculer un prix de revient au km d'une voiture sur une période définie par l'utilisateur. Pour ce faire voici le code :
Dim x1 As Long
Dim x2 As Long
Dim Cell1 As Variant
Dim Cell2 As Date
Dim Cell3 As Date
Dim Cell4 As Long
Dim Cell5 As Variant
Dim Cell6 As Long
Dim Cell7 As Long
Dim Cell8 As Long
Dim Cell9 As Long
Dim I3 As Long
Dim J3 As Long
Dim G3 As Date
Dim H3 As Date
Dim F3 As Variant
Set Cell1.Value = Sheets("Voiture").Range("A6:A10000").Value
Set Cell2.Value = Sheets("Voiture").Range("B6:B10000").Value
Set Cell3.Value = Sheets("Voiture").Range("K6:K10000").Value
Set Cell4.Value = Sheets("Voiture").Range("J6:J10000").Value
Set Cell5.Value = Sheets("Inventaire").Range("B6:B10000").Value
Set Cell6.Value = Sheets("Inventaire").Range("E6:E10000").Value
Set Cell7.Value = Sheets("Inventaire").Range("F6:F10000").Value
Set Cell8.Value = Sheets("Inventaire").Range("G6:G10000").Value
Set Cell9.Value = Sheets("Inventaire").Range("H6:H10000").Value
Set I3.Value = Sheets("Inventaire").Range("I3").Value
Set J3.Value = Sheets("Inventaire").Range("J3").Value
Set G3.Value = Sheets("Inventaire").Range("G3").Value
Set H3.Value = Sheets("Inventaire").Range("H3").Value
Set F3.Value = Sheets("Inventaire").Range("F3").Value
For Each F3 In Cell1
If G3 <= Cell2 And H3 >= Cell3 Then x1 = Cell4 + x1
Next
For Each F3 In Cell5
x2 = Cell6 + Cell7 + Cell8
I3 = x1 + x2
J3 = I3 / Cell9
Next
End Sub
J'ai surligné l'endroit où le pb de qualificateur incorrect intervient, de plus en changeant le.Value, je rencontre des pbs d'odjet requis.
J'espère que vous pouvez m'aider, merci pour le temps accordé à ce post.
Bien cordialement.