Erreur d'exécution 6 Dépassement de capacité
Résolu
lesafio
-
lesafio -
lesafio -
bonjour, pour commencer je voudrai vous dire que je viens débuté sur vba excel. je viens d'ecrir une macro mais quand je la lance sa me fait une erreur d'exécution '6' tel est le titre.
quand je clic sur débogage, sa me souligne la 2ième ligne dans le second DO, loop until
Comment puis je faire pour résoudre ce probleme.
je vous remercie d'avance
Sub macro1()
Dim i As Long
Dim j As Long
i = 3
j = 2
Sheets("Feuil1").Select
Range("A3:R60000").Select
Selection.ClearContents
Do
Sheets("variation client").Select
Range(Cells(j, 4), Cells(j, 5)).Select
Selection.Copy 'copie de la colonne 4 à 10(référence, Désignation, Quantité, PRI, Valorisation, Emplacement, CMM)
Sheets("Feuil1").Select
Range(Cells(i, 1), Cells(i, 2)).Select
ActiveSheet.Paste
i = i + 1
j = j + 1
Loop Until (Sheets("variation client").Cells(j, 1).Value = "")
i = 3
j = 2
Do
Sheets("Feuil1").Cells(i, 3).Value = (Sheets("variation client").Cells(j, 10).Value - Sheets("variation client").Cells(j, 9).Value) / Sheets("variation client").Cells(j, 9).Value
Sheets("Feuil1").Cells(i, 4).Value = (Sheets("variation client").Cells(j, 15).Value - Sheets("variation client").Cells(j, 14).Value) / Sheets("variation client").Cells(j, 14).Value
Sheets("Feuil1").Cells(i, 5).Value = (Sheets("variation client").Cells(j, 20).Value - Sheets("variation client").Cells(j, 19).Value) / Sheets("variation client").Cells(j, 19).Value
Sheets("Feuil1").Cells(i, 6).Value = (Sheets("variation client").Cells(j, 24).Value - Sheets("variation client").Cells(j, 23).Value) / Sheets("variation client").Cells(j, 23).Value
Sheets("Feuil1").Cells(i, 7).Value = (Sheets("variation client").Cells(j, 28).Value - Sheets("variation client").Cells(j, 27).Value) / Sheets("variation client").Cells(j, 27).Value
Sheets("Feuil1").Cells(i, 8).Value = (Sheets("variation client").Cells(j, 32).Value - Sheets("variation client").Cells(j, 31).Value) / Sheets("variation client").Cells(j, 31).Value
Sheets("Feuil1").Cells(i, 9).Value = (Sheets("variation client").Cells(j, 36).Value - Sheets("variation client").Cells(j, 35).Value) / Sheets("variation client").Cells(j, 35).Value
Sheets("Feuil1").Cells(i, 10).Value = (Sheets("variation client").Cells(j, 40).Value - Sheets("variation client").Cells(j, 39).Value) / Sheets("variation client").Cells(j, 39).Value
Sheets("Feuil1").Cells(i, 11).Value = (Sheets("variation client").Cells(j, 44).Value - Sheets("variation client").Cells(j, 43).Value) / Sheets("variation client").Cells(j, 43).Value
Sheets("Feuil1").Cells(i, 12).Value = (Sheets("variation client").Cells(j, 48).Value - Sheets("variation client").Cells(j, 47).Value) / Sheets("variation client").Cells(j, 47).Value
Sheets("Feuil1").Cells(i, 13).Value = (Sheets("variation client").Cells(j, 52).Value - Sheets("variation client").Cells(j, 51).Value) / Sheets("variation client").Cells(j, 51).Value
Sheets("Feuil1").Cells(i, 14).Value = (Sheets("variation client").Cells(j, 56).Value - Sheets("variation client").Cells(j, 55).Value) / Sheets("variation client").Cells(j, 55).Value
Sheets("Feuil1").Cells(i, 15).Value = (Sheets("variation client").Cells(j, 60).Value - Sheets("variation client").Cells(j, 59).Value) / Sheets("variation client").Cells(j, 59).Value
Sheets("Feuil1").Cells(i, 16).Value = (Sheets("variation client").Cells(j, 64).Value - Sheets("variation client").Cells(j, 63).Value) / Sheets("variation client").Cells(j, 63).Value
Sheets("Feuil1").Cells(i, 17).Value = (Sheets("variation client").Cells(j, 68).Value - Sheets("variation client").Cells(j, 67).Value) / Sheets("variation client").Cells(j, 67).Value
Sheets("Feuil1").Cells(i, 18).Value = (Sheets("variation client").Cells(j, 72).Value - Sheets("variation client").Cells(j, 71).Value) / Sheets("variation client").Cells(j, 71).Value
Loop Until (Sheets("variation client").Cells(j, 1) = "")
End Sub
quand je clic sur débogage, sa me souligne la 2ième ligne dans le second DO, loop until
Comment puis je faire pour résoudre ce probleme.
je vous remercie d'avance
Sub macro1()
Dim i As Long
Dim j As Long
i = 3
j = 2
Sheets("Feuil1").Select
Range("A3:R60000").Select
Selection.ClearContents
Do
Sheets("variation client").Select
Range(Cells(j, 4), Cells(j, 5)).Select
Selection.Copy 'copie de la colonne 4 à 10(référence, Désignation, Quantité, PRI, Valorisation, Emplacement, CMM)
Sheets("Feuil1").Select
Range(Cells(i, 1), Cells(i, 2)).Select
ActiveSheet.Paste
i = i + 1
j = j + 1
Loop Until (Sheets("variation client").Cells(j, 1).Value = "")
i = 3
j = 2
Do
Sheets("Feuil1").Cells(i, 3).Value = (Sheets("variation client").Cells(j, 10).Value - Sheets("variation client").Cells(j, 9).Value) / Sheets("variation client").Cells(j, 9).Value
Sheets("Feuil1").Cells(i, 4).Value = (Sheets("variation client").Cells(j, 15).Value - Sheets("variation client").Cells(j, 14).Value) / Sheets("variation client").Cells(j, 14).Value
Sheets("Feuil1").Cells(i, 5).Value = (Sheets("variation client").Cells(j, 20).Value - Sheets("variation client").Cells(j, 19).Value) / Sheets("variation client").Cells(j, 19).Value
Sheets("Feuil1").Cells(i, 6).Value = (Sheets("variation client").Cells(j, 24).Value - Sheets("variation client").Cells(j, 23).Value) / Sheets("variation client").Cells(j, 23).Value
Sheets("Feuil1").Cells(i, 7).Value = (Sheets("variation client").Cells(j, 28).Value - Sheets("variation client").Cells(j, 27).Value) / Sheets("variation client").Cells(j, 27).Value
Sheets("Feuil1").Cells(i, 8).Value = (Sheets("variation client").Cells(j, 32).Value - Sheets("variation client").Cells(j, 31).Value) / Sheets("variation client").Cells(j, 31).Value
Sheets("Feuil1").Cells(i, 9).Value = (Sheets("variation client").Cells(j, 36).Value - Sheets("variation client").Cells(j, 35).Value) / Sheets("variation client").Cells(j, 35).Value
Sheets("Feuil1").Cells(i, 10).Value = (Sheets("variation client").Cells(j, 40).Value - Sheets("variation client").Cells(j, 39).Value) / Sheets("variation client").Cells(j, 39).Value
Sheets("Feuil1").Cells(i, 11).Value = (Sheets("variation client").Cells(j, 44).Value - Sheets("variation client").Cells(j, 43).Value) / Sheets("variation client").Cells(j, 43).Value
Sheets("Feuil1").Cells(i, 12).Value = (Sheets("variation client").Cells(j, 48).Value - Sheets("variation client").Cells(j, 47).Value) / Sheets("variation client").Cells(j, 47).Value
Sheets("Feuil1").Cells(i, 13).Value = (Sheets("variation client").Cells(j, 52).Value - Sheets("variation client").Cells(j, 51).Value) / Sheets("variation client").Cells(j, 51).Value
Sheets("Feuil1").Cells(i, 14).Value = (Sheets("variation client").Cells(j, 56).Value - Sheets("variation client").Cells(j, 55).Value) / Sheets("variation client").Cells(j, 55).Value
Sheets("Feuil1").Cells(i, 15).Value = (Sheets("variation client").Cells(j, 60).Value - Sheets("variation client").Cells(j, 59).Value) / Sheets("variation client").Cells(j, 59).Value
Sheets("Feuil1").Cells(i, 16).Value = (Sheets("variation client").Cells(j, 64).Value - Sheets("variation client").Cells(j, 63).Value) / Sheets("variation client").Cells(j, 63).Value
Sheets("Feuil1").Cells(i, 17).Value = (Sheets("variation client").Cells(j, 68).Value - Sheets("variation client").Cells(j, 67).Value) / Sheets("variation client").Cells(j, 67).Value
Sheets("Feuil1").Cells(i, 18).Value = (Sheets("variation client").Cells(j, 72).Value - Sheets("variation client").Cells(j, 71).Value) / Sheets("variation client").Cells(j, 71).Value
Loop Until (Sheets("variation client").Cells(j, 1) = "")
End Sub
A voir également:
- Erreur d'exécution 6 Dépassement de capacité
- Nero 6 - Télécharger - Gravure
- Belote a 6 - Forum Graphisme
- Erreur 3005 france tv - Forum TV & Vidéo
- Le logiciel amd a détecté un dépassement de délai du pilote - Forum Carte graphique
- Gta 6 trailer 2 - Guide
1 réponse
Bonjour,
J'ai pas encore bien regardé ton 2èm DO, mais tu peu remplacé le premier DO par...
Ca fait exactement la même chose.
Ca pourrait peut-être te donner une idée pour modifier ton 2èm DO ?
A+
EDIT :
Le dépassement de capacité c'est parce que ta boucle n'a pas de fin
Tu n'icrémente pas j
L'expérience instruit plus sûrement que le conseil. (André Gide)
Si tu te cogne à un pot et que ça sonne creux, c'est pas forcément le pot qui est vide. ;-)(Confucius)
J'ai pas encore bien regardé ton 2èm DO, mais tu peu remplacé le premier DO par...
Dim DerLig As Long
DerLig = Range("A65535").End(xlUp).Row
Range(Cells(2, 4), Cells(DerLig, 10)).Copy Sheets("Feuil1").Range("A3")
Ca fait exactement la même chose.
Ca pourrait peut-être te donner une idée pour modifier ton 2èm DO ?
A+
EDIT :
Le dépassement de capacité c'est parce que ta boucle n'a pas de fin
Tu n'icrémente pas j
L'expérience instruit plus sûrement que le conseil. (André Gide)
Si tu te cogne à un pot et que ça sonne creux, c'est pas forcément le pot qui est vide. ;-)(Confucius)
dans mon tableau ou il y a les valeurs il peut y avoir des 0 ou d'autre valeur. le calcul que j'ai effectué avec la macro est standard pour toutes les celules.
la je cherche un moyen qui va me permettre de mettre 0 si le dénominateur est égale à 0.