bonjour,
je voudrai faire afficher les 2 chiffres a près la virgule. comment faire.

exemple: dans tableau1 la somme xxx,70 alors que le résultat avec
Code : Sélectionner tout - Visualiser dans une fenêtre à part
Somme1 = Application.WorksheetFunction.Sum(Tableau1)
me donne xxx,00 j'ai essayé
Code : Sélectionner tout - Visualiser dans une fenêtre à part
Somme1 = Application.WorksheetFunction.Sum(Tableau1).numberformat = "0.00"
merci.

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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Dim Tableau1, tableau2, tableau3bis, tableau4 As Range 'Variable
Dim Somme1 As Single
Dim Somme2 As Single
Dim Somme3 As Single
Dim Somme4 As Single
Dim TotSol As Single
Dim sold1 As Single
Dim sold2 As Single
 
 
derniereLigne = Range("B" & Rows.Count).End(xlUp).Row + 1
derniereLigne = Range("C" & Rows.Count).End(xlUp).Row + 1
derniereLigne = Range("D" & Rows.Count).End(xlUp).Row + 1
derniereLigne = Range("E" & Rows.Count).End(xlUp).Row + 1
 
Set Tableau1 = Range("B:B")
Set tableau2 = Range("C:C")
Set tableau3bis = Range("D:D")
Set tableau4 = Range("E:E")
 
Set tableaux1 = Range("f:f")
Set tableaux2 = Range("g:g")
 
 
Somme1 = Application.WorksheetFunction.Sum(Tableau1)
 
Somme2 = Application.WorksheetFunction.Sum(tableau2)
Somme3 = Application.WorksheetFunction.Sum(tableau3bis)
Somme4 = Application.WorksheetFunction.Sum(tableau4)
sold1 = Application.WorksheetFunction.Sum(tableaux1)
sold2 = Application.WorksheetFunction.Sum(tableaux2)
 
 
 ActiveCell.Offset(0, 0).FormulaR1C1 = _
 Somme1
 ActiveCell.Offset(0, 1).FormulaR1C1 = _
 Somme2
 ActiveCell.Offset(0, 2).FormulaR1C1 = _
 Somme3
 ActiveCell.Offset(0, 3).FormulaR1C1 = _
 Somme4
 
 ActiveCell.Offset(0, 4).FormulaR1C1 = _
 sold1
 
 ActiveCell.Offset(0, 5).FormulaR1C1 = _
 sold2
 '----------------------------
 ActiveCell.Offset(1, 1).FormulaR1C1 = _
 Somme1 - Somme2
 ActiveCell.Offset(1, 0).Select
 
 ActiveCell.Offset(0, 3).FormulaR1C1 = _
 Somme4 - Somme3
 ActiveCell.Offset(1, 1).Select
 
'------------------------------------
 
ActiveCell.Offset(0, 4).FormulaR1C1 = _
sold2 - sold1
ActiveCell.Offset(1, 2).Select