Re: Last updated time for cell

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Bob Phillips (bob.phillips_at_notheretiscali.co.uk)
Date: 05/09/04


Date: Sun, 9 May 2004 11:15:19 +0100

Using an explicit range when you have a target seems superfluous to put it
mildly

Private Sub Worksheet_Change(ByVal Target As Range)

    On Error GoTo ws_exit:
    Application.EnableEvents = False
    If Not Intersect(Target, Me.Range("A1:A10")) Is Nothing Then
        With Target
            If .Value <> "" Then
                .Offset(0,1).Value = Format(Now, "dd mmm yyyy hh:mm:ss")
            End If
        End With
    End If

ws_exit:
    Application.EnableEvents = True
End Sub

-- 
HTH
Bob Phillips
    ... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"Gord Dibben" <gorddibbATshawDOTca> wrote in message
news:1i3r90h6ginadr7f6acoi2o1u4ke344vv7@4ax.com...
> Larence
>
> Private Sub Worksheet_Change(ByVal Target As Excel.Range)
> 'Col B time will not change if data in Col A is edited
> On Error GoTo enditall
> Application.EnableEvents = False
> If Not Intersect(Target, Me.Range("a1:a10")) Is Nothing Then
> n = Target.Row
>         If Excel.Range("A" & n).Value <> "" _
>             And Excel.Range("B" & n).Value = "" Then
>             Excel.Range("B" & n).Value = Format(Now, "dd mmm yyyy
hh:mm:ss")
>         End If
>     End If
> enditall:
> Application.EnableEvents = True
> End Sub
>
> Gord Dibben Excel MVP
>
> On Sat, 08 May 2004 19:16:44 -0400, "Lawrence M. Seldin, CMC, CPC"
> <larryTAKEOUT@Seldin.net> wrote:
>
> >Bob,
> >
> >I got your code to work. Thank you.
> >
> >
> >Is there a way, to change the code you gave me to point to range of
cells.
> >
> >Like the price I want monitored is A1..A10 and the updated value would be
B1..B10
> >
> >Thanks much,
> >
> >--------------------- begin
> >
> >Private Sub Worksheet_Change(ByVal Target As Range)
> >
> >    On Error GoTo ws_exit:
> >    Application.EnableEvents = False
> >    If Not Intersect(Target, Me.Range("C1")) Is Nothing Then
> >        Me.Range("H1").Value = Format(Now, "dd mmm yyyy hh:mm:ss")
> >    End If
> >
> >ws_exit:
> >    Application.EnableEvents = True
> >End Sub
> >
> >-------------------   end
> >Lawrence M. Seldin, CMC, CPC
> >Author of POWER TIPS FOR THE APPLE NEWTON and INTRODUCTION TO CSP
> >Author of RECRUITSOURCE PEOPLESOFT EXAM and RECRUITSOURCE SAP/R3 EXAM
> >
> >
> >NOTE: To send me an email, remove TAKEOUT from my email address:
larryTAKEOUT@seldin.net
> >
> >NOTE: My web home page:    www.seldin.net
>

Quantcast