Macro to add Quantity or Subtract Quantity On Stock

Xefi

New Member
Joined
May 17, 2022
Messages
3
Office Version
  1. 2021
  2. 2019
  3. 2016
Platform
  1. Windows
Hello, I am looking for a solution to my VBA. I am looking to add a reference in cells G7 or H7, this allows you to add or remove a quantity and
update our stock


My Excel

Classeur3
BCDEFGH
4
5ReferencetagQuantityReference
6123clock 114Add +1 quantityReduce -1 quantity
7124watch 25
8125applewatch7
9126samsung 224
10127windows 333
11128apple 15
Feuil1




thank you very much for all help .
Do you have any ideas for success?
 

Attachments

  • 1652807042019.png
    1652807042019.png
    326 bytes · Views: 6

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
How about this?

VBA Code:
Sub AddSubtract()
Dim RF As Range:    Set RF = Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row).Find(Range("F2").Value2, , xlValues, xlWhole)
Dim Trg As Range:   Set Trg = RF.Offset(, 2)
Dim Add As Range:   Set Add = Range("F4")
Dim Subt As Range:  Set Subt = Range("G4")

Trg.Value = Trg.Value + (Add.Value - Subt.Value)

End Sub
 
Upvote 0
I don't understand the code , I have to adapt it and continue?
 
Upvote 0
by adding a reference in cell G7 or H7 this takes the value of the quantity in column D to add or subtract it. Then it erases the G7 and H7 cells by updating the stock
 
Upvote 0

Forum statistics

Threads
1,215,223
Messages
6,123,714
Members
449,118
Latest member
MichealRed

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top