VBA to clear contents of a cell based on another cell's value

Sean Lim

New Member
Joined
Jan 27, 2022
Messages
6
Office Version
  1. 2013
Platform
  1. Windows
Hello, need some assistance on VBA code.
In my worksheet, I have column AI as Quantity In, AJ as Quantity Out, AK as Quantity Balance and AT as Location.
Column AI and AJ is manual input by user, while AK has a formula (=AI-AJ) which means Quantity In minus Quantity Out.
I wish to have VBA that assist me to deduct the Location cell (AT) whenever user changes the value in AJ as 1.
For example, when a new unit comes in, user will input 1 in cell AI6 (Qty In), 0 in cell AJ6 (Qty Out) and the formula will calculate cell AK6 as 1 (Qty Balance).
The location (cell AT6) will also input by user.
When the unit is shipped, user will amend cell AJ6 (Qty Out) to 1 and AK6 (Qty Balance) will be calculated by formula to 0. If this happens, VBA can help me to automatically remove the contents in location (cell AT6).
Appreciate your help!
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Attachments

  • Sample.png
    Sample.png
    119.1 KB · Views: 8
Upvote 0

Forum statistics

Threads
1,214,980
Messages
6,122,563
Members
449,088
Latest member
Motoracer88

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