additon of values automatically

M

Mario

hi
i have the following problem but no solution,

i want to format the cells B2:R99 as follow
for example B4 (like all others) if u enter a number it should add it
automatically for example:

Step1: input in B4 of 4 - output: 4 - algorithmus in formulr bar:
4
Step1: input in B4 of 5 - output: 9 - algorithmus in formulr bar:
=4+5
Step1: input in B4 of 3 - output 12 -algorithmus in formulr bar =
4+5+3
Step1: input in B4 of -4 output 8 - algorithmus in formulr bar
=4+5+3-4


i want to create a material list for a project for others, but this list
contains of 500 positions and 5 tables
but i want these data to be pursue-able . i am not really good in makro
programming, i have an additions algorithmus makro witch adds but it does
not give the algorithmus in the formular bar just the vallue of the output,
(for example only vallue 9 instead of '=4+5+7-7')

hope someone could help me

kind regards

mario
 
D

Don Guillett

This macro will automatically use cell a5 to add/subtract IN cell a5. Use 0
to start over.
Right click on the sheet tab>view code>copy/paste this> SAVE workbook.

Option Explicit
Dim oldvalue As Double
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$A$5" Then
On Error GoTo fixit
Application.EnableEvents = False
If Target.Value = 0 Then oldvalue = 0
Target.Value = 1 * Target.Value + oldvalue
oldvalue = Target.Value
fixit:
Application.EnableEvents = True
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top