Bonjour,
Les variables nbrecette et nbdepense prennent des nombres dépassant 7 chiffres (exemple: 1081500), j'ai mis comme type as long, as integer, as variant, as currency et aucun n'accepte, j'ai toujours l'erreur
"Dépassement de capacité".
J'ai pas trouver de solution dans google et dans ce forum.
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 Dim x As Integer Dim y As String Dim arret As Boolean Dim soldecol As Long Dim nbrecette As Long Dim nbdepense As Long Dim deprow As Integer Dim recrow As Integer arret = False For j = lastrow To 1 Step -1 ws_dest.Cells(j, soldecol).Select If ws_dest.Cells(j, soldecol).Value <> "" Then arret = True ws_dest.Cells(j + 1, soldecol).Value = "SOLDE" ' creation de la ligne solde = recette - depense For soldecol = soldecol + 1 To lastcol 'ligne recette nbrecette = ws_dest.Cells(recrow, soldecol).Value 'ligne depense nbdepense = ws_dest.Cells(deprow, soldecol).Value x = nbrecette - nbdepense y = CStr(x) ws_dest.Cells(j + 1, soldecol).Value = y If y = "0" Then ws_dest.Cells(j + 1, soldecol).Value = "" End If Next soldecol End If If arret = True Then Exit For End If Next j ..... end sub
Partager