View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
systematic[_15_] systematic[_15_] is offline
external usenet poster
 
Posts: 1
Default Macro to insert Now() when cell updates


Hi there,

I'm trying to write a macro, so that if a cell in a range has a valu
placed in it - Now() is written to a corresponding cell in anothe
column, then the value copied and pasted (so that it does not update).

I have this -

private sub worksheet_change(byval target as range)

if target.address(false, false) = \"f6:f45\" then
application.enableevents = false

if range(\"f6:f45\") = \"1\" then
range(\"d6:d45\").value = now()

else
range(\"d6:d45\") = \"no call taken\"

end if

application.enableevents = true

end if

range(\"d6:d45\").select
selection.copy
range(\"d6:d45\").select
selection.pastespecial paste:=xlpastevalues, operation:=xlnone
skipblanks _
:=false, transpose:=false

end sub

For some reason it does not want to work for me. I have EnableEvent
set to True on workbook open and am running Office XP.

Would appreciate any advice to steer me in the right direction as I a
still quite new to VBA!

Thanks

Ro

--
systemati
-----------------------------------------------------------------------
systematic's Profile: http://www.excelforum.com/member.php...fo&userid=2529
View this thread: http://www.excelforum.com/showthread.php?threadid=49610