excel - VBA Record date of row change in specific column -


i'm trying automatically update "updated" column of excel spreadsheet when cell of specific row changes today's date. able hard-coding "updated" column header be, however, necessary search column header may move.

the code trying implement works gives me error automation error - object invoked has disconnected it's clients.

any appreciated. here code have currently:

private sub worksheet_change(byval target range)     if not intersect(target, range("a:dx")) nothing         dim f range          set f = activesheet.range("a1:dd1").find("updated", lookat:=xlwhole)         ' f.row = range(target).row          if not f nothing            range(split(f.address, "$")(1) & target.row).value =         else             msgbox "'updated' header not found!"         end if     end if end sub 

you got endless loop. try this:

private sub worksheet_change(byval target range)     if not intersect(target, range("a:dx")) nothing         dim f range          set f = activesheet.range("a1:dd1").find("updated", lookat:=xlwhole)         ' f.row = range(target).row          if f nothing             msgbox "'updated' header not found!"         elseif intersect(target, f.entirecolumn) nothing             intersect(target.entirerow, f.entirecolumn).value = '        else '            msgbox "we entered function again because row above updated updated column", vbinformation, "false alarm"         end if     end if end sub 

to understand happens,

  • uncomment else , msgbox
  • put breakpoint on msgbox
  • when hit it, press [ctrl]-l

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

c# - MSDN OneNote Api: Navigate to never before opened page without opening a OneNote Application Window -