ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Running total macro issue (https://www.excelbanter.com/excel-programming/428076-running-total-macro-issue.html)

Onyx[_2_]

Running total macro issue
 

Hello everyone, and thanks in advance for the help.

I sell a number of items and am using an excel sheet to keep track of
them. I currently have it set so that a number of buttons I click
increment a column of numbers that show how many I need to make of that
item (to replenish stock). I then have a 3rd column keeping track of how
many I have sold of that item. Here is an example:

Item A | 5 | 103

In this example, I have recently sold (and need to make) 5 of item A.
In the past I've sold 103 total.

Currently, I'm doing it all manually. I need a macro that will add the
numbers in column B into column C and then delete column B.

So in the example above, after running the macro, it would look like:

Item A | 0 | 108

I have a large number of rows I need this done on, and more rows may be
added in the future.

If you need any more information, please let me know.


--
Onyx
------------------------------------------------------------------------
Onyx's Profile: http://www.thecodecage.com/forumz/member.php?userid=290
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=93859


Per Jessen[_2_]

Running total macro issue
 
Hi

Add another button to "Update Totals", and call this macro (change the
Sub name as required. In my example qunatities recently sold is in
B2:B10.

Private Sub CommandButton1_Click()
Dim TargetRange As Range
Dim Cell As Range
Set TargetRange = Range("B2:B10")
For Each Cell In TargetRange
Cell.Offset(0, 1) = Cell.Offset(0, 1) + Cell.Value
Cell.Value = 0
Next
End Sub

Hopes this helps.

---
Per

On 6 Maj, 19:19, Onyx wrote:
Hello everyone, and thanks in advance for the help.

I sell a number of items and am using an excel sheet to keep track of
them. I currently have it set so that a number of buttons I click
increment a column of numbers that show how many I need to make of that
item (to replenish stock). I then have a 3rd column keeping track of how
many I have sold of that item. Here is an example:

Item A | 5 | 103

In this example, I have recently sold (and need to make) 5 of item A.
In the past I've sold 103 total.

Currently, I'm doing it all manually. I need a macro that will add the
numbers in column B into column C and then delete column B.

So in the example above, after running the macro, it would look like:

Item A | 0 | 108

I have a large number of rows I need this done on, and more rows may be
added in the future.

If you need any more information, please let me know.

--
Onyx
------------------------------------------------------------------------
Onyx's Profile:http://www.thecodecage.com/forumz/member.php?userid=290
View this thread:http://www.thecodecage.com/forumz/sh...ad.php?t=93859




All times are GMT +1. The time now is 03:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com