gds35
XLDnaute Impliqué
Mes AMIS du furoms bonjour ,bon WE
Je desire calculer le tmp 'Ticket moyen pondéré' ds les Lignes 'TOTAL' du tableau tant que la valeur en "C" est Diffrente de 0 ou blanc impossible d'y arriver car si une cellule = 0 je tombe en erreur 006, d'autre part le calcul est mal posionné , il est sur la ligne DECEMBRE au lieu de la ligne TOTAL , voila le puis le code ecrit :
Sub STAT1202ST()
'
Sheets("TRTMOIS1202").Activate
Dim NOL As Integer
Dim NOC As Integer
Dim DON As Integer
Dim CalST As Variant
'
'NOLTMP = 5
'
DON = Application.WorksheetFunction.CountA(Range("C2:C65536"))
For NOL = DON + 2 To 5 Step -3
Cells(NOL, 3).EntireRow.Insert
Range("B" & NOL).Select
Selection.Value = "Total "
For NOC = 3 To 8
CalST = Application.Sum(Range(Cells(NOL - 3, NOC), Cells(NOL - 1, NOC)))
Cells(NOL, NOC) = CalST
Next
Next
'
' RECALCUL DU TMP TRIMESTRIEL
'
Do While Cells(NOL, 2) <> ""
Cells(NOL, 9) = Cells(NOL, 4) / Cells(NOL, 3) ' TMP MIDI
Cells(NOL, 10) = Cells(NOL, 6) / Cells(NOL, 5) ' TMP SOIR
Cells(NOL, 11) = Cells(NOL, 7) / Cells(NOL, 8) ' TMP JOUR
NOL = NOL + 4
Loop
'
''Excel.Run ("STAT0305")
'
End Sub
OU peux se situer l'erreur???
Merci de votre aide . Cordialemnt GDS35
Je desire calculer le tmp 'Ticket moyen pondéré' ds les Lignes 'TOTAL' du tableau tant que la valeur en "C" est Diffrente de 0 ou blanc impossible d'y arriver car si une cellule = 0 je tombe en erreur 006, d'autre part le calcul est mal posionné , il est sur la ligne DECEMBRE au lieu de la ligne TOTAL , voila le puis le code ecrit :
Sub STAT1202ST()
'
Sheets("TRTMOIS1202").Activate
Dim NOL As Integer
Dim NOC As Integer
Dim DON As Integer
Dim CalST As Variant
'
'NOLTMP = 5
'
DON = Application.WorksheetFunction.CountA(Range("C2:C65536"))
For NOL = DON + 2 To 5 Step -3
Cells(NOL, 3).EntireRow.Insert
Range("B" & NOL).Select
Selection.Value = "Total "
For NOC = 3 To 8
CalST = Application.Sum(Range(Cells(NOL - 3, NOC), Cells(NOL - 1, NOC)))
Cells(NOL, NOC) = CalST
Next
Next
'
' RECALCUL DU TMP TRIMESTRIEL
'
Do While Cells(NOL, 2) <> ""
Cells(NOL, 9) = Cells(NOL, 4) / Cells(NOL, 3) ' TMP MIDI
Cells(NOL, 10) = Cells(NOL, 6) / Cells(NOL, 5) ' TMP SOIR
Cells(NOL, 11) = Cells(NOL, 7) / Cells(NOL, 8) ' TMP JOUR
NOL = NOL + 4
Loop
'
''Excel.Run ("STAT0305")
'
End Sub
OU peux se situer l'erreur???
Merci de votre aide . Cordialemnt GDS35