Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    static date (office 2003)

    how to generate static date conditionally

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: static date (office 2003)

    Welcome to Woody's Lounge!

    Could you provide a more detailed description of what you want to accomplish?

  3. #3
    New Lounger
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: static date (office 2003)

    thanks for responding
    when building up data and while a record is being entered in a row is it possible to generate static date in a column with out keying in control+;
    for example an entry is made in column 'b' , is it possible to generate static date in column 'd' if value in 'b' meets certain requirement

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: static date (office 2003)

    You could use the Worksheet_Change event for this:
    - Right-click the sheet tab.
    - Select View Code from the popup menu.
    - Copy the following code into the module window that appears:
    <code>
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim oCell As Range
    ' Did cells in column B get changed?
    If Not Intersect(Target, Range("B:B")) Is Nothing Then
    ' Don't handle other events for the time being
    Application.EnableEvents = False
    ' Loop through changed cells in column B
    For Each oCell In Intersect(Target, Range("B:B")).Cells
    ' *** Modify condition as needed ***
    If oCell > 10 Then
    ' Set date in same row, column D
    oCell.Offset(0, 2) = Date
    Else
    ' Optional - clear cell in column D if condition not met
    oCell.Offset(0, 2).ClearContents
    End If
    Next oCell
    ' Resume handling other events
    Application.EnableEvents = True
    End If
    End Sub
    </code>
    - Modify the line <code>If oCell > 10 Then</code> to suit your needs.

Posting Permissions

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