VBA problème avec fin de programme sans message d'erreur mais variable hors du contexte
Bonjour,
J'ai un petit problème, J'ai une procédure Principale qui appelle une procédure de Facturation d'un produit avec un simple
Code:
1 2 3
| SELECT Case FactureType
CASE "MaFactureType" CALL MaFacture |
Dans la procédure, il y a une condition
Code:
IF faFINAL = "FINAL"
appel d'une procédure EviterTicketOUDoublon 'Dans le tableau qui contient les produits à facturer si l il manque 1 contrat, il y a un ticket et on ne facture pas et on passe à la ligne suivante :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
If Sheets(sData).Cells(ChRow, fMid).Value = fdDuo Then GoTo EviterTicketsOuDoublons
With Sheets(chTab)
.Cells(j, 1).Value = Sheets(sData).Cells(ChRow, Fval1)
.Cells(j, 2).Value = Sheets(sData).Cells(ChRow, Fval2)
.Cells(j, 3).Value = Sheets(sData).Cells(ChRow, Fval3)
.Cells(j, 4).Value = Sheets(sData).Cells(ChRow, Fval4)
.Cells(j, 5).Value = Sheets(sData).Cells(ChRow, Fval5)
.Cells(j, 6).Value = Sheets(sData).Cells(ChRow, Fval6)
.Cells(j, 12).FormulaR1C1 = "=RC[-1]*RC[-2]"
End With
fdDuo = Sheets(sData).Cells(ChRow, fMid)
j = j + 1
k = k + 1
If faFinal = "Final" Then Call historiserFinal |
Si c'est une facture finale, il y a un onglet d'historique ou chaque ligne de la facture est inscrite sinon non :
l'appel de l'historisation :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
Sub historiserFinal()
If Sheets(sData).Cells(ChRow, fTik).Value <> 0 Then GoTo Fin
With Sheets(sHisto)
.Cells(j, 1).Value = Sheets(sData).Cells(ChRow, Fval1)
.Cells(j, 2).Value = Sheets(sData).Cells(ChRow, Fval2)
.Cells(j, 3).Value = Sheets(sData).Cells(ChRow, Fval3)
.Cells(j, 4).Value = Sheets(sData).Cells(ChRow, Fval4)
.Cells(j, 5).Value = Sheets(sData).Cells(ChRow, Fval5)
.Cells(j, 6).Value = Sheets(sData).Cells(ChRow, Fval6)
.Cells(j, 12).FormulaR1C1 = "=RC[-1]*RC[-2]"
End With |
La première ligne est historisée ensuite fin du programme sans message d'erreur mais dans le mode debug un espin chRow à la valeur <Hors du contexte>.
Merci si quelqu'un peut m'aider