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
|
Private Sub Btn_MAJSTOCk_Click()
'------------------------------------------------------------- APPEL DE LA FONCTION POUR MAJ DU STOCK -------------------------------------------
Call edit_from_sheet
'------------------------------------------------------------- FIN APPEL DE LA FONCTION POUR MAJ DU STOCK -------------------------------------------
'-------------------------------------------------------------- MISE A JOUR FEUILLE DE SUIVI -------------------------------------------
Dim Lign As Integer
Lign = 1
While Sheets("Suivi").Range("A" & Lign).Value <> ""
Lign = Lign + 1
Wend
Sheets("Suivi").Range("A" & Lign).Value = Me.Date_Pickup
Sheets("Suivi").Range("B" & Lign).Value = Me.List_Mat
Sheets("Suivi").Range("C" & Lign).Value = Me.Qte_Pickup
Sheets("Suivi").Range("D" & Lign).Value = Me.List_Tech
Sheets("Suivi").Range("E" & Lign).Value = "Prélèvement"
'Envoi mail au Team Leader
' declaration des variables
Dim MonOutlook As Object
Dim MonMessage As Object
Dim corps As String
Set MonOutlook = CreateObject("Outlook.Application")
' creation du message pour le destinataire
Set MonMessage = MonOutlook.createitem(0)
MonMessage.to = "ADRESSE MAIL"
MonMessage.Subject = "Nouvelle Mise à jour fichier stock" & " " & "- Prélèvement -"
corps = "Bonjour, une nouvelle saisie a été effectuée dans le fichier stock"
MonMessage.body = corps
' envoi des mails
MonMessage.send
Set MonOutlook = Nothing
'-------------------------------------------------------------- FIN MISE A JOUR FEUILLE DE SUIVI -------------------------------------------
Unload Me 'permet de réactualiser la fenêtre UserForm
MsgBox "Prélèvement stock enregistré.", vbExclamation
Inventaire.Show
End Sub
Function edit_from_sheet() 'MISE A JOUR DE LA QUANTITE EN STOCK
Dim rng1 As Range
Dim Str_search As String
Str_search = List_Mat.Value
ThisWorkbook.Sheets("SHEMA STOCK").Activate
Set rng1 = Sheets("SHEMA STOCK").Range("R:R").Find(Str_search, , xlValues, xlWhole)
If Not rng1 Is Nothing Then
rng1.Select
Dim row_number As Long
row_number = ActiveCell.Row
ThisWorkbook.Sheets("SHEMA STOCK").Activate
Sheets("SHEMA STOCK").Range("V" & row_number) = Sheets("SHEMA STOCK").Range("V" & row_number).Value - Qte_Pickup.Value
Else
MsgBox Str_search & "Non Trouvé"
End If
End Function |
Partager