+ Reply to Thread
Results 1 to 2 of 2

Date Time Stamp Formula

  1. #1
    katie.teitelbaum@gmail.com
    Guest

    Date Time Stamp Formula

    Hello,
    I am trying to create a formula that will insert the date and time into
    a new cell only when another cell is "0". In other words, if the
    specific cell hits 0, then the current date and time when the cell hits
    0 is recorded in the other cell. If the cell is anything except 0,
    then the other cell is blank or says "not finished". I tried the if
    and now formulas to no avail and my macro is returning a VALUE error,
    so I'm completely lost. Any help would be much appreciated.

    Thanks,
    Katie


  2. #2
    Bob Phillips
    Guest

    Re: Date Time Stamp Formula

    Katie,

    It is a lot simpler with VBA This tests A1 and puts the date and time in B1

    Option Explicit

    Private Sub Worksheet_Change(ByVal Target As Range)
    Const WS_RANGE As String = "A1"

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

    ws_exit:
    Application.EnableEvents = True
    End Sub

    'This is worksheet event code, which means that it needs to be
    'placed in the appropriate worksheet code module, not a standard
    'code module. To do this, right-click on the sheet tab, select
    'the View Code option from the menu, and paste the code in.




    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    <katie.teitelbaum@gmail.com> wrote in message
    news:1130193947.145715.324700@z14g2000cwz.googlegroups.com...
    > Hello,
    > I am trying to create a formula that will insert the date and time into
    > a new cell only when another cell is "0". In other words, if the
    > specific cell hits 0, then the current date and time when the cell hits
    > 0 is recorded in the other cell. If the cell is anything except 0,
    > then the other cell is blank or says "not finished". I tried the if
    > and now formulas to no avail and my macro is returning a VALUE error,
    > so I'm completely lost. Any help would be much appreciated.
    >
    > Thanks,
    > Katie
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1