Automatically set value to empty cells in Excel when another cell is populated -


i have spreadsheet tracks information on shared network drive. when user adds row, entering data next available row, cell b, want set few other cells default values. instance, cell should 1up number, cell c should user name, , cell d should current date, time stamp.

individually, know how pieces, not know how set cells when cell b changed blank not blank.

i not opposed using vba, avoid if possible.

some of things wish record easier vba. use following worksheet event macro:

private sub worksheet_change(byval target range)     dim s string      if intersect(target, range("b:b")) nothing exit sub     ary = split(environ("homepath"), "\")     s = ary(ubound(ary))     application.enableevents = false         target             .offset(0, -1).value = .offset(-1, -1).value + 1             .offset(0, 1).value = s             .offset(0, 2).value =         end     application.enableevents = true end sub 

enter image description here

because worksheet code, easy install , automatic use:

  1. right-click tab name near bottom of excel window
  2. select view code - brings vbe window
  3. paste stuff in , close vbe window

if have concerns, first try 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:

  1. bring vbe windows above
  2. clear code out
  3. close vbe window

to learn 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 learn more event macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm

macros must enabled work!


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -