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
| Sub recordata(itemNum, ItemDes, ItemQty, Itemdate, ItemCTA, itemProj, ItemDA, nlenre)
If Sheets("Prev").Cells(nlenre, 1).Value = "" Then Sheets("Prev").Cells(nlenre, 1).Value = ItemCTA
If Sheets("Prev").Cells(nlenre, 2).Value = "" Then Sheets("Prev").Cells(nlenre, 2).Value = itemNum
If Sheets("Prev").Cells(nlenre, 3).Value = "" Then Sheets("Prev").Cells(nlenre, 3).Value = ItemDes
Sheets("Prev").Cells(nlenre, 4).NumberFormat = "@"
If Sheets("Prev").Cells(nlenre, 4).Value = "" Then
Sheets("Prev").Cells(nlenre, 4).Value = itemProj
Else
valrech = InStr(Sheets("Prev").Cells(nlenre, 4).Text, itemProj, 1) 'le problème est ici
If Not (valrech >= 1) Then
Sheets("Prev").Cells(nlenre, 4).Value = Sheets("Prev").Cells(nlenre, 4).Value & vbLf & itemProj
End If
End If
If Sheets("Prev").Cells(nlenre, 5).Value = "" Then
Sheets("Prev").Cells(nlenre, 5).Value = ItemDA
Else
valrech = InStr(Sheets("Prev").Cells(nlenre, 5).Value, ItemDA, 1)
If Not (valrech >= 1) Then
Sheets("Prev").Cells(nlenre, 5).Value = Sheets("Prev").Cells(nlenre, 5).Value & vbLf & ItemDA
End If
End If
If WorksheetFunction.EoMonth(Itemdate, 0) < WorksheetFunction.EoMonth(Date, -2) + 1 Then
recdate = Sheets("Prev").Cells(1, initcell).Value
Else
recdate = Format(Itemdate, "mm/yy")
End If
'recherche le mois d'affectation des Qtés
ncol = Application.WorksheetFunction.Match(recdate, Rows(1), 0)
Sheets("Prev").Cells(nlenre, ncol).Value = ItemQty + Sheets("Prev").Cells(nlenre, ncol).Value
'mise en couleur de la case
If ItemDA <> "" Then
Call colorDA(nlenre, ncol) 'vert si DA
Else
Call colorprev(nlenre, ncol) 'bleu si planned order
End If
End Sub |
Partager