Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8618681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:10:09+00:00 2026-06-12T06:10:09+00:00

I want to create two date stamps, one for OK and one for NOT

  • 0

I want to create two date stamps, one for OK and one for NOT OK. The values are filled in in column A and are 'x' for OK and 'NOK' for NOT OK.

When ‘x’ is filled in in column A, the value in column 49 should be the datestamp when ‘x’ is filled in.

When ‘NOK’ is filled in in column, the value in column 52 should be the datestamp when ‘NOK’ is filled in.

Also, if ‘x’ or ‘NOK’ is removed from column A, so should the datestamp dissappear. This is what I have.

Private Sub Worksheet_Change(ByVal Target As Range)
    '49 = ok
    '52 = NOK

    Dim KeyCells As Range

    ' The variable KeyCells contains the cells that will
    ' cause an alert when they are changed.
    Set LastRow = Range("A" & Rows.Count).End(xlUp).Row
    Set KeyCells = Range("A1:" & LastRow)

    If Application.Intersect(KeyCells, Range(Target.Address)) Like "*x*" Then
        Cells(Row, 49).Value = Format(DateTime.Now, "yyyy-MM-dd hh:mm:ss")
    End If

    If Application.Intersect(KeyCells, Range(Target.Address)) Like "*NOK*" Then
        Cells(Row, 52).Value = Format(DateTime.Now, "yyyy-MM-dd hh:mm:ss")
    End If

End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T06:10:10+00:00Added an answer on June 12, 2026 at 6:10 am

    Here, try this:

    Private Sub Worksheet_Change(ByVal Target As Range)
        '49 = ok '52 = NOK
        Application.EnableEvents = False
    
        With Target
        'check if change happend in column A
        If .Column = 1 Then
          'check if changed value is X
          If .Value Like "*x*" Then
              'add datestamp if it is
              Cells(.Row, 49).Value = Format(DateTime.Now, "yyyy-MM-dd hh:mm:ss")
          Else
              'clear datestamp if not
              Cells(.Row, 49).Value = ""
          End If
    
          If .Value Like "*NOK*" Then
              Cells(.Row, 52).Value = Format(DateTime.Now, "yyyy-MM-dd hh:mm:ss")
          Else
              Cells(.Row, 52).Value = ""
          End If
        End If
        End With
        Application.EnableEvents = True
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create two widgets in flex. One for the movies ( that
I have a state column in a dataframe and I want to create two
I want to create a table that stores values from two different tables; From
I want to create two dates that contain the beginning date of a month
I want to create a view from the following two tables: Entry: entry_id entry_date
I want to create two equal timestamps for a given day in PHP and
I want to create two and three dimensional vectors using a constructor in a
i am preparing my android apps in which i want to create two row
I want to create a two level ExpandableListView from a local database. The group
I want to create a two-dimensional array in which I want to store records

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.