excel - Creating a Timestamp VBA -


need macro:

private sub worksheet_change(byval target range) if target.column = 2     application.enableevents = false     cells(target.row, 3).value = date + time     application.enableevents = true end if end sub  sub deletecells() each cell in range("b3:b25")     if isblank(cell.value)         cell.offset(0, 1).clear     end if next end sub 

the purpose of macro create timestamp. first macro works fine. if row b filled in, timestamp created in row c. however, delete cells function isn't working. want if deletes cell in row b, timestamp deleted.

try this:

private sub worksheet_change(byval target range) dim rng range, c range      'anything in colb?     set rng = application.intersect(me.columns(2), target)     if rng nothing exit sub 'nothing process...      application.enableevents = false     'could >1 cell, loop on them...     each c in rng.cells         'skip cells errors         if c.row>=3 , not iserror(c.value) '<<edit             c.entirerow.cells(3).value = _                 iif(len(c.value) > 0, now, "")         end if     next c     application.enableevents = true  end sub 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -