Bonjour,
J'ai une macro sous VBA Excel qui réalise la 2 moyennes, chacune sur 2 mois et résultat se présente sous la forme Moyenne1 / Moyenne2.
Le problème, est pour certaines concaténations j'ai un format date qui apparait.
Ex :
Mois1 = 4, Mois2 = 2, Mois 3 = 1 et Mois4 = 1 le résultat devrait être :
Moyenne1 / Moyenne2 avec :
Moyenne1 = (Mois1+Mois2)/2 soit 3
Moyenne2 = (Mois3+Mois4)/2 soit 1
Soit : 3/1
Mais le résultat obtenu pour certains est de type date par ex : 01-MAR.
Pouvez m'aider?
Merci d'avance,
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 For i = 2 To 10 Mois1 = Cells(i, 5) Mois2 = Cells(i, 6) Mois3 = Cells(i, 7) Mois4 = Cells(i, 8) If IsNumeric(Mois1) = True And IsNumeric(Mois2) = True Then If IsEmpty(Mois1) = False And IsEmpty(Mois2) = False Then Moyennne1 = Application.WorksheetFunction.average(Mois1, Mois2) End If End If If IsNumeric(Mois3) = True And IsNumeric(Mois4) = True Then If IsEmpty(Mois3) = False And IsEmpty(Mois4) = False Then Moyennne2 = Application.WorksheetFunction.average(Mois3, Mois4) End If End If Cells(i, 4) = Moyennne1 & "/" & Moyennne2 Next i
Partager