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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
| Sub Bouton2_QuandClic()
pprod = Range("b4").Value
op = Range("b5").Value
vvaleur = Range("b6").Value
ddate = Range("b7").Value
vdiff = Range("b10").Value
If op = "" Or vvaleur = "" Or ddate = "" Or pprod = "" Then
MsgBox ("Toutes les zones doivent être renseignées")
Exit Sub
End If
If op <> "Commande" Then
rep = MsgBox("Vous allez mettre à jour le stock, Voulez vous contiuer ?", vbYesNo)
If rep = vbYes Then
Range("b5:b6").ClearContents
Worksheets("Produits Référencés").Select
Cells.Find(What:=pprod, After:=ActiveCell, LookIn:=xlFormulas, _
lookat:=xlWhole, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
If op = "Inventaire" Then
Cells(ActiveCell.Row, 6).Value = vvaleur
lili1 = ActiveCell.Row
lili2 = ActiveCell.Row + 151
End If
If op = "Entrée" Then
Cells(ActiveCell.Row, 6).Value = Cells(ActiveCell.Row, 6).Value + vvaleur
lili1 = ActiveCell.Row
lili2 = ActiveCell.Row + 151
End If
If op = "Sortie" Then
Cells(ActiveCell.Row, 6).Value = Cells(ActiveCell.Row, 6).Value - vvaleur
lili1 = ActiveCell.Row
lili2 = ActiveCell.Row + 151
End If
End If
Worksheets(2).Select
Else
rep2 = MsgBox("Vous allez mettre à jour les commandes, Voulez vous contiuer ?", vbYesNo)
If rep2 = vbYes Then
Range("b5:b6").ClearContents
Worksheets("Commande").Select
Range("a1").Activate
Cells.Find(What:=pprod, After:=ActiveCell, LookIn:=xlValues, _
lookat:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Cells(ActiveCell.Row, 2).Value = ddate
Cells(ActiveCell.Row, 3).Value = vvaleur
Cells(ActiveCell.Row, 4).Value = "Non"
End If
End If
End Sub
Sub Bcomm_QuandClic()
Range("d3:d500").Select
For Each cece In Selection
If cece.Value = "Oui" Then
dquant = Cells(cece.Row, cece.Column - 1).Value
ddate = Range("b1").Value
dprod = Cells(cece.Row, cece.Column - 3).Value
lili1 = cece.Row - 1
lili2 = cece.Row + 500 - 1
Worksheets("Produits Référencés").Select
Cells(lili1, 6).Value = Cells(lili1, 6).Value + dquant
Worksheets("Commande").Select
Cells(cece.Row, cece.Column - 2).ClearContents
Cells(cece.Row, cece.Column - 1).ClearContents
Cells(cece.Row, cece.Column).ClearContents
End If
Next
Range("a1").Select
End Sub |
Partager