ADD (A3+A1) IN MS EXCEL. I WANT OUTPUT IN CELL A3. HOW ?

Common problems – different language?
Let's talk in English.

ADD (A3+A1) IN MS EXCEL. I WANT OUTPUT IN CELL A3. HOW ?

Poslaťod Palo-admin » 30.01.2010, 13:51

from seshu ramakrishna posted at Sunday, January 24, 2010 12:53 PM

Dear ALL,
I want a macro for following scene...plz help any body...

I HAVE TWO VALUES IN CELL:A1 & CELL:A3
NOW I WANT ADD THE TWO VALUES IN CELL A3 & IF I CHANGE THE VALUE IN A1 THEN THAT VALUE TO BEE ADDED TO A3+A1 & SAME ......
HOW IT POSSIBLE PLZ GUIDE ME.

EX:
A1=6,A3=3
NOW I WANT IN A3=9
IF I CHANGED IN A1(A3 HAVING 9 ONLY) MEANS NOW A1=10

THEN A3 BECOMES 9+10 MEANS A3=19.& SAME CONTNUIOUS HOW IT POSSIBLE.....


If I correct understand your problem, you need increase value of cell A3 by summing old A3 value plus value in cell A1.
I prepare simple example to solve it (see link http://www.pc-prog.eu/phpBB3/images/xMyKB/Sum_Increasing.xls)

How is it done.

Function Worksheet_Change over the worksheet Sheet1(to see code how, press ALT+F11) is used.
There is also used in macro named range range_Input(cells C3:C4)

When any value in range range_Input (cells C3:C4) is changed, value in neighboring cell (column D) is calculated

Kód: Vybrať všetko
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo xErr:
    If Not Intersect(Target, Range("range_Input")) Is Nothing Then
        Application.EnableEvents = False
        'calculate Raising Sum
        Target.Offset(0, 1).Value = Target.Value + Target.Offset(0, 1).Value
        Application.EnableEvents = True
    End If
    Exit Sub
   
xErr:
     Application.EnableEvents = True
End Sub


Palo
Palo-admin
Administrátor stránky
 
Príspevky: 473
Registrovaný: 18.07.2008, 16:43
Udelené poďakovania: 6 krát
Prijaté poďakovania: 63 krát

Späť na Solving MS Office problems in English

Kto je on-line

Užívatelia prezerajúci fórum: Žiadny registrovaný užívateľ nie je prítomný a 1 hosť

cron