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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
| Sub Test()
Dim Report As String
Dim tonnage As Double
Dim charge As Double
Dim ligne, dateg, ladatechiffre, finmois As Double
Dim i, n As Integer
Dim ladate, datereport As Date
ladate = InputBox("Entrez le mois et année à reporter (sous format : MM/YYYY, 03/2017 par exemple")
ladatechiffre = CDbl(ladate)
finmois = Day(Application.WorksheetFunction.EoMonth(ladate, 0))
ligne = ladatechiffre + finmois
i = 2
dateg = CDbl(Cells(2, 1))
While ligne > dateg
i = i + 1
dateg = CDbl(Cells(i, 1))
Wend
Rows(i).Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
election.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Do
Cells(i, 1) = InputBox("Quel est la date a reporter? (JJ/MM/YYYY)")
Cells(i, 2) = "Report"
Cells(i, 4) = InputBox("Quel est le client?")
Cells(i, 5) = InputBox("Quel est le pays?")
tonnage = InputBox("Combien on a déjà reporter.")
n = 0
While datereport <> Cells(i, 1)
n = n + 1
datereport = Cells(n, 1)
Wend
charge = Cells(n, 16)
Cells(i, 6) = charge - tonnage
Cells(i, 8) = InputBox("Quel produit?")
Cells(i, 10) = InputBox("Quel est son statut?")
i = i + 1
Loop While MsgBox("Voulez-vous répéter l'opération", vbYesNo) = yes
End Sub |
Partager