View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Steve[_74_] Steve[_74_] is offline
external usenet poster
 
Posts: 39
Default how to reset a value in a cell after another

1) RightClick on the tab of the sheet where you need your accumulator
2) Click 'View Code'
3) Paste

"mondy" wrote in message
...
Hi again..
thanks for the code. but I have a question where did i put the code? as I
said before I'm newbie and i dont know how to use visual basic together
with
excel..
thanks again...

"Mike Fogleman" wrote:

I have modified the two-cell accumulator method from the linked site to
match what you want.
Note: change "A1" to where your unit quantity is
change "A2" to where the cumulative total is
change "B1" to where the retail price is or substitute the
price
for 'Range("B1").Value'
to hard code the number in the code


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Address(False, False) = "A1" Then 'change "A1" to where
your
unit quantity is
If IsNumeric(.Value) Then
Application.EnableEvents = False
Range("A2").Value = Range("A2").Value + (.Value *
Range("B1").Value) 'change "A2" & "B1"
.Value = 0
Application.EnableEvents = True
End If
End If
End With
End Sub

"Mike Fogleman" wrote in message
...
Here is a link to using a cell to accumulate totals. It also explains
the
pitfall of doing this.
http://www.mcgimpsey.com/excel/accumulator.html

Mike F

"Mondy" wrote in message
...
hello, i'm new here and i want some help from you guys. hope you'll
help
me
with this..

i want to create program in excel just like inventory of item sales.
example

product Name ------------------ name of product
quantity:____ ----------------- quantity of the item sold will be
input
here (i.e. 1)

total amount:_____------------------- number inputted in quantity
will
multiply by the fix retail price of prodcuct will be shown here.

I want to make a program like this---- after the amount is shown in
the
Total amount Cell, I want the cell in a quantity where I input a
number
will
be reset to zero so I can input another quantity, but the new number
that
i
will input will be added to the previous number.

Hope you help me guysss.. more power.