Substract cells using vba

cambi

New Member
Joined
Feb 15, 2023
Messages
2
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. Windows
Hi Guys,

Im trying to substract from a cell using a togglebutton
the idea is that when I press the "Record Daily Production" I can substract the kgs produced on the "T" column to the kgs ordered in "R" column
the same with cases from column "U" to the cases from column "S"
I have around 1000 rows so it takes forever checking all rows.
1676473126994.png


Thank you in advance
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
the idea is that when I press the "Record Daily Production" I can substract the kgs produced on the "T" column to the kgs ordered in "R" column
Your screen shot indicates it is not a 1 to 1 relationship for kgs ordered vs. kgs produced so what is your intent for deciding which Col R value and which Col T value to use in the subtraction operation for your 1000 rows of data?
 
Upvote 0
Your screen shot indicates it is not a 1 to 1 relationship for kgs ordered vs. kgs produced so what is your intent for deciding which Col R value and which Col T value to use in the subtraction operation for your 1000 rows of data?

Hi rlv01

im using VBA to add kg orders into row R and row T is pulling information from a report using "SumIF" formula,

I want the command button to to substract the kgs produced in column T to the amount that I have in column R and keep the result in column R,

basically is it possible that when i click the command button "Record Daily Production" that the KG remainings from the equation to be 1000kg (1500kg - 500kg=1000kg)
but for all rows with data on them rather than just that row.
1676479400504.png


I dont know if that makes more sense,
Thank you in advance
 

Attachments

  • 1676479370510.png
    1676479370510.png
    13.5 KB · Views: 1
Upvote 0
I dont know if that makes more sense,
Not really. You did not answer my question about how you intend to handle the one-to-many relationship

You would probably be better off posting some sample data along with what results you are expecting and where you are expecting them to go. If your 1000 rows of data contains more than one value for 'kg ordered' or spans more than one day, your sample data should as well. Also, if you post data as a screen shot as you did above, most people will move on to someone else's problem since life is too short to manually re-type it in order to experiment. Better you should use the free XL2BB tool (link below) to post your data in a way that makes it accessible to others.

 
Upvote 0

Forum statistics

Threads
1,215,091
Messages
6,123,062
Members
449,090
Latest member
fragment

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