Hello, I have a workbook with two sheets Sheet 1- Oldstock 2021-2022 : It contains warehouse information Sheet 2- Transaction we are selling & returning items stated Question 1: About the information we got from the first article We have two processes: the sale (Sale) and the return (retrieval) and the quantity sold or returned After putting the quantity sold, I want to make a confirmation in order to transfer NEWSTOCK to Quantity in stock on the first sheet. Question 2: 2- How to add the current date automatically each time I add a new line I put it now () but how is it written automatically The file is attached. Thank you.
Add and subtract from another sheet
- Jasmin
- Thread is marked as Resolved.
-
-
-
Here's an example that contains a layout to store transactions, i.e. stock in and out and a master sheet that shows current tock levels updated by formulas.
-
Hello, I have a workbook with two sheets Sheet 1- Oldstock 2021-2022 : It contains warehouse information Sheet 2- Transaction we are selling & returning items stated Question 1: About the information we got from the first article We have two processes: the sale (Sale) and the return (retrieval) and the quantity sold or returned After putting the quantity sold, I want to make a confirmation in order to transfer NEWSTOCK to Quantity in stock on the first sheet. Question 2: 2- How to add the current date automatically each time I add a new line I put it now () but how is it written automatically The file is attached. Thank you.
You got it figured out yet or do you need additional help?
-
Here's an example that contains a layout to store transactions, i.e. stock in and out and a master sheet that shows current tock levels updated by formulas.
Thank you very much, I will try the same in my work & get back to you.
You are a life saver roy. -
The formulas are fairly easy to adapt. Note I use Tables which are much better for this purpose.
Post back if you are unsure of anything.
-
-
Here's another solution in case anyone is interested later:
Code
Display MoreOption Explicit Dim fo As Worksheet Dim ln&, x!, s& Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.CountLarge > 1 Then Exit Sub If Target.Row > 2 And Target.Column = 7 Then Application.EnableEvents = False Set fo = Sheets("OldStock2021-2022") If Range("B" & Target.Row) <> "" And Range("F" & Target.Row) <> "" Then ln = WorksheetFunction.Match(Target.Offset(0, -5), fo.Range ("C:C"), 0) x = fo.Cells(ln, 5) 'Stok initial sur la feuille OldStock2021-2022 Cells(Target.Row, 3) = fo.Range("D" & ln) 'Description Cells(Target.Row, 4) = fo.Range("G" & ln) 'Prix Cells(Target.Row, 5) = x 'Stock initial s = IIf(Target.Offset(0, -1) = "sell", -1, 1) 'sens du mouvement = 1 pour retour,-1 pour vente Cells(Target.Row, 9) = Target.Value * s + x 'Stock final fo.Range("E" & ln) = Target.Value * s + x 'Nouveau stock mis à jour Range("A" & Target.Row) = Date 'ou = Now si on veut l'horodate Else MsgBox "Saisies incomplètes.", 16 Exit Sub End If End If Application.EnableEvents = True End Sub Sub Evenement() Application.EnableEvents = True End Sub
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!