Add value from one cell to another then reset cell value. Excel -


hope can answer us.

we want following:

when value entered in a1, value added value of b1.

we want value of a1 reset 0, keep value of b1

is possible in excel?

on worksheet's vba private module (right-click report tab , hit "view code"), enter following code:

private sub worksheet_change(byval target range)     application.enableevents = false     if target.address = range("a1").address         range("b1") = range("b1") + range("a1")         range("a1").clearcontents     end if     application.enableevents = true end sub 

worksheet_change called whenever change made worksheet.

application.enableevents=false prevents code running continuously (without it, change b1 call worksheet_change).

this code assumes value in b1 numeric (or blank). if may contain character text, check need put in place either reset value or not increment.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -