How to use a code to display the current date based on certain criteria

< Back to Search results

 Category: [Excel]  Demo Available 

How to use a code to display the current date based on certain criteria




The user has a blank A-column that is starting from A600;
next to it a blank B-column that is also starting from B600

What the user needs is a code/formula/macro that whenever something will be inserted in column B (starting from B600) -> the column A will react by displaying the current date.

Furthermore what I really need is that the date will not change once it has been inserted.






Copy and paste this macro into the worksheet code module. Do the following: right click the tab for your sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Enter a value in column B in any row >=600 and exit the cell.

Private Sub Worksheet_Change(ByVal Target As Range)
    Application.ScreenUpdating = False
    If Target.Row > 599 And Target.Column = 2 Then
        Target.Offset(0, -1) = Date
    End If
    Application.ScreenUpdating = True
End Sub




Obtained from the OzGrid Help Forum.

Solution provided by Mumps.


See also: Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions and Index to new resources and reference sheets


See also:

How to display a message for each if the value is greater than the mentioned values
How to list & display all files in user folder, select file and copy specific tab into master sheet
How to use VBA Code in Excel to display a balloon
How to create a macro to display names not row numbers


Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.


stars (0 Reviews)