View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Record update date in cell

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Errorhandler
If Target.Address = "$M$7" Then
Application.EnableEvents = False
Worksheets("Strategy Map").TextBox1.Value = Target.Value
End If
If Target.Address = "$AV$17" Then
Application.EnableEvents = False
Target.Offset(0, 1) = Format$(Now, "dd/mm/yy")
End If
Errorhandler:
Application.EnableEvents = True
End Sub

--
Regards,
Tom Ogilvy


"Phil Hageman" wrote in message
...
Hi Tom,

You are exactly right - there are two in this worksheet code page , below.
Could you tell me how to combine the two?

Thanks, Phil

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Errorhandler
If Target.Address = "$M$7" Then
Application.EnableEvents = False
Worksheets("Strategy Map").TextBox1.Value = Target.Value
End If
Errorhandler:
Application.EnableEvents = True
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$AV$17" Then
Target.Offset(0, 1) = Format$(Now, "dd/mm/yy")
End If
End Sub

"Phil Hageman" wrote:

Hi Patrick,

I put the code in the worksheet VBA, and received the following compile
error: "Ambiguous name detected" Worksheet_Change." The first line of

code
is highlighted yellow. Where did I go wrong?

Thanks, Phil

"Patrick Molloy" wrote:

you need to used th esheet's changed event to populate the cell with

the
actual date/time. If yuo use a formula, then that will change each

time the
sheet recalculates.
right click the sheet tab & select the code page. Add this...


Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$AV$17" Then
Target.Offset(0, 1) = Format$(Now, "dd/mm/yy hh:mm")
End If
End Sub



"Phil Hageman" wrote:

Cell AV17 holds data that is periodically updated. In cell AV18 I

need a
formula to have the date of the AV17 update automatically inserted.

What
would the formula be?