excel - Adding value to the last cell -
excel - Adding value to the last cell -
i need help something, in theory @ least, simple:
you come in value in 1 cell (a1), value added b1. add together value (replacing previous value) in a1, c1 created value, , goes on.
i need maintain history saved, @ same time, simplifying input method.
i appreciate help. thanks.
put next event macro in worksheet code area:
private sub worksheet_change(byval target range) dim range, n long set = range("a1") if intersect(target, a) nil exit sub application.enableevents = false n = cells(1, columns.count).end(xltoleft).column + 1 cells(1, n).value = a.value application.enableevents = true end sub
because worksheet code, easy install , automatic use:
right-click tab name near bottom of excel window select view code - brings vbe window paste stuff in , close vbe windowif have concerns, first seek on trial worksheet.
if save workbook, macro saved it. if using version of excel later 2003, must save file .xlsm rather .xlsx
to remove macro:
bring vbe windows above clear code out close vbe windowto larn more macros in general, see:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
and
http://msdn.microsoft.com/en-us/library/ee814735(v=office.14).aspx
to larn more event macros (worksheet code), see:
http://www.mvps.org/dmcritchie/excel/event.htm
macros must enabled work!
edit#1
remove first version , replace with:
private sub worksheet_change(byval target range) dim range, n long, whichrow long set = range("a:a") if intersect(target, a) nil exit sub application.enableevents = false whichrow = target.row n = cells(whichrow, columns.count).end(xltoleft).column + 1 cells(whichrow, n).value = target.value application.enableevents = true end sub
excel
Comments
Post a Comment