Announcement

Collapse
No announcement yet.

Retain previous date function

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Retain previous date function



    Hi I need a help. Please find the attached Image. I have a Column M with data validation. If I select "In Progress" in Column M, It should update today() function in Column N and If select "Complete" in Column M It should update today() function in Column O but this should not effect Column N(it should retain previous date)
    Attached Files

  • #2
    Use this macro in the sheet that you want it to run

    Code:
    Private Sub Worksheet_Change(ByVal Target As Range)
    
    Dim OldEvents As Boolean
    
    OldEvents = Application.EnableEvents
    Application.EnableEvents = False
    
    If Range(ActiveCell.Address).Column = 13 _
    And ActiveCell = "In Progress" _
    And IsEmpty(Range("N" & ActiveCell.Row)) Then
        Range("N" & ActiveCell.Row) = Date
    ElseIf Range(ActiveCell.Address).Column = 13 _
    And ActiveCell = "Complete" _
    And IsEmpty(Range("O" & ActiveCell.Row)) Then
        Range("O" & ActiveCell.Row) = Date
    Else
    End If
    
    Application.EnableEvents = OldEvents
    
    End Sub

    Comment


    • #3


      Thank you so much!!

      Comment

      Working...
      X