bonjour j ai creer un fonction pour button mais je veux que cette fonction sera comme macro complemantaire comment faire pour faire entré les données plage et utiliser comme fonction comme somme
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
 
 
i = 1
j = 1
k = 1
cpt = 0
cpt1 = 0
 
 
While Not IsEmpty(Feuil1.Cells(i, 1))
 
 If CInt(Left(Feuil1.Cells(i, 1), 1)) = j Then
     cpt = cpt + Feuil1.Cells(i, 1)
 End If
 
 If CInt(Left(Feuil1.Cells(i, 1), 1)) <> j Then
    ThisWorkbook.Sheets("Feuil1").Select
    Feuil1.Cells(i, 1).Select
    Selection.EntireRow.Insert
    Feuil1.Cells(i, 1) = cpt
    Feuil1.Cells(i, 1).Font.Color = vbRed
    cpt1 = cpt1 + cpt
    i = i + 1
    j = j + 1
    cpt = Feuil1.Cells(i, 1)
 
 End If
 
i = i + 1
 
Wend
    ThisWorkbook.Sheets("Feuil1").Select
    Feuil1.Cells(i, 1).Select
    Selection.EntireRow.Insert
    Feuil1.Cells(i, 1) = cpt
    Feuil1.Cells(i, 1).Font.Color = vbRed
    cpt1 = cpt1 + cpt
    i = i + 1
 
    Feuil1.Cells(i, 1).Select
    Selection.EntireRow.Insert
    Feuil1.Cells(i, 1) = cpt1
    Feuil1.Cells(i, 1).Font.Color = vbBlue