how do I do this in Excel. I used this to work for column A but I also want to do additional columns -
how do in excel? used work column want additional columns
private sub worksheet_change(byval target range) dim t range, r range set t = intersect(target, range("a:a")) if t nothing exit sub application.enableevents = false each r in t r .offset(0, 1).value = .offset(0, 1).value + .value .clearcontents end next r application.enableevents = true end sub
try this:
private sub worksheet_change(byval target range) dim t range, r range dim columnarray() string, columnstocopy string dim integer columnstocopy = inputbox("what columns (a,b,c, etc.) copy data of? use spaces, separate columns") columnarray() = split(columnstocopy) = lbound(columnarray) ubound(columnarray) set t = intersect(target, range("" & columnarray(i) & ":" & columnarray(i) & "")) 'columns(columnarray(i)) & ":" & columns(columnarray(i)))) if t nothing exit sub application.enableevents = false each r in t r .offset(0, 1).value = .offset(0, 1).value + .value .clearcontents end next r next application.enableevents = true end sub that create popup, asking columns want run on. what's thought behind running every time cell changes? that's going lot of pop-ups, etc. let me know if doesn't work or has error.
Comments
Post a Comment