philipos_353
XLDnaute Nouveau
Bonjour au forum,
Pourriez vous me corriger ma Macro concernant le saut de liqne qui se fait automatiquement sur mon bon de commande modèle en PJ, j'ai bien défini la première ligune et ensuite cela saute automatiquement de plusieurs lignes et inverse même quelques Numéro d'articles.
Merci
' Traitement d'un stock
Private Function Stock(i, c, t)
With Sheets(t)
l = 5 ' 1ère ligne vérifiée dans le sommaire
While (.Cells(l, 2) > "")
a$ = .Cells(l, 2)
e$ = .Cells(l, 5)
b$ = .Cells(l, 3)
d$ = .Cells(l, 4)
f$ = .Cells(l, 6)
s$ = .Cells(l, 7)
qnom = .Cells(l, 8)
un$ = .Cells(l, 9)
qext = .Cells(l, 10)
' Si quantité existante < quantité nominale
' alors insérer dans le bon de commande la qté manquante
If (qext < qnom) Then
With Sheets("Requisition ")
x = 1 + (i - 1) Mod 16
lbc = 14 + x + 23 * c
If x = 15 Then c = c + 1
.Cells(lbc, 1) = a$
.Cells(lbc, 2) = s$
.Cells(lbc, 4) = d$
.Cells(lbc, 5) = e$
.Cells(lbc, 3) = f$
.Cells(lbc, 5) = qext
.Cells(lbc, 6) = qnom - qext
End With
i = i + 1
End If
l = l + 1
Wend
End With
Stock = i + c * 1000
End Function
Pourriez vous me corriger ma Macro concernant le saut de liqne qui se fait automatiquement sur mon bon de commande modèle en PJ, j'ai bien défini la première ligune et ensuite cela saute automatiquement de plusieurs lignes et inverse même quelques Numéro d'articles.
Merci
' Traitement d'un stock
Private Function Stock(i, c, t)
With Sheets(t)
l = 5 ' 1ère ligne vérifiée dans le sommaire
While (.Cells(l, 2) > "")
a$ = .Cells(l, 2)
e$ = .Cells(l, 5)
b$ = .Cells(l, 3)
d$ = .Cells(l, 4)
f$ = .Cells(l, 6)
s$ = .Cells(l, 7)
qnom = .Cells(l, 8)
un$ = .Cells(l, 9)
qext = .Cells(l, 10)
' Si quantité existante < quantité nominale
' alors insérer dans le bon de commande la qté manquante
If (qext < qnom) Then
With Sheets("Requisition ")
x = 1 + (i - 1) Mod 16
lbc = 14 + x + 23 * c
If x = 15 Then c = c + 1
.Cells(lbc, 1) = a$
.Cells(lbc, 2) = s$
.Cells(lbc, 4) = d$
.Cells(lbc, 5) = e$
.Cells(lbc, 3) = f$
.Cells(lbc, 5) = qext
.Cells(lbc, 6) = qnom - qext
End With
i = i + 1
End If
l = l + 1
Wend
End With
Stock = i + c * 1000
End Function