Incompatibilité de type
p
voici le code qui me retourne l'erreur?
Private Sub Worksheet_Activate()
'ligne1
Dim lc, societe, math, phy, metodologie, dtech, elec, trigo, calphy, techno, dschema, ep, base, techniquemetier, techniquecomplementaire, prat As Single
prat = Range("D9").Value + Range("E9").Value
lc = Range("G7").Value * Range("G9").Value
societe = Range("H7").Value * Range("H9").Value
math = Range("M7").Value * Range("M9").Value
phy = Range("N7").Value * Range("N9").Value
metodologie = Range("O7").Value * Range("O9").Value
dtech = Range("K7").Value * Range("K9").Value
elec = Range("J7").Value * Range("J9").Value
trigo = Range("I7").Value * Range("I9").Value
calphy = Range("Q7").Value * Range("Q9").Value
techno = Range("R7").Value * Range("R9").Value
dschema = Range("S7").Value * Range("S9").Value
ep = Range("T7").Value * Range("T9").Value
If math = 0 And phy <> 0 And metodologie <> 0 Then
base = Round((math + phy + metodologie) / 3, 1)
ElseIf math <> 0 And phy = 0 And metodologie <> 0 Then
base = Round((math + phy + metodologie) / 3, 1)
ElseIf math <> 0 And phy <> 0 And metodologie = 0 Then
base = Round((math + phy + metodologie) / 4, 1)
ElseIf math = 0 And phy = 0 And metodologie <> 0 Then
base = Round(math + phy + metodologie, 1)
ElseIf math <> 0 And phy = 0 And metodologie = 0 Then
base = Round((math + phy + metodologie) / 2, 1)
ElseIf math = 0 And phy <> 0 And metodologie = 0 Then
base = Round((math + phy + metodologie) / 2, 1)
ElseIf math = 0 And phy = 0 And metodologie = 0 Then
base = 0
Else
base = Round((math + phy + metodologie) / 5, 1)
End IfBonjour,
Sans grande conviction.
Tu préciseras la ligne qui pose problème .
Cdlt.
Option Explicit
Private Sub Worksheet_Activate()
Dim prat As Double, lc As Double, societe As Double, math As Double, _
phy As Double, metodologie As Double, dtech As Double, elec As Double, _
trigo As Double, calphy As Double, techno As Double, dschema As Double, _
ep As Double, base As Double
prat = [D9] + [E9]
lc = [G7] * [G9]
societe = [H7] * [H9]
math = [M7] * [M9]
phy = [N7] * [N9]
metodologie = [O7] * [O9]
dtech = [K7] * [K9]
elec = [J7] * [J9]
trigo = [I7] * [I9]
calphy = [Q7] * [Q9]
techno = [R7] * [R9]
dschema = [S7] * [S9]
ep = [T7] * [T9]
Select Case True
Case math = 0 And phy <> 0 And metodologie <> 0
base = Round((phy + metodologie) / 3, 1)
Case math <> 0 And phy = 0 And metodologie <> 0
base = Round((math + metodologie) / 3, 1)
Case math <> 0 And phy <> 0 And metodologie = 0
base = Round((math + phy) / 4, 1)
Case math = 0 And phy = 0 And metodologie <> 0
base = Round(metodologie, 1)
Case math <> 0 And phy = 0 And metodologie = 0
base = Round(math / 2, 1)
Case math = 0 And phy <> 0 And metodologie = 0
base = Round(phy / 2, 1)
Case math = 0 And phy = 0 And metodologie = 0
base = 0
Case Else
base = Round((math + phy + metodologie) / 5, 1)
End Select
End Subp
merci, je vais essayer
c'est la première ligne qui passe pas et je suppose les autres aussi
prat = [D9] + [E9]
lc = [G7] * [G9]
societe = [H7] * [H9]
math = [M7] * [M9]
phy = [N7] * [N9]
metodologie = [O7] * [O9]
dtech = [K7] * [K9]
elec = [J7] * [J9]
trigo = [I7] * [I9]
calphy = [Q7] * [Q9]
techno = [R7] * [R9]
dschema = [S7] * [S9]
ep = [T7] * [T9]Re,
Que contiennent les cellules D9 et E9 ?
Cdlt.
p
j'ai trouvé.
en fait je voulais calculer avec des formules déjà existantes dans ces cellules. j'ai enlever ces formules et maintenant ça marche.
merci beaucoup.