Enter "today's" date when data entered into a specific cell?

MikeyW1969

Board Regular
Joined
Apr 28, 2014
Messages
78
Hi guys,
I'm setting up an Excel sheet to maintain a spreadsheet for asset management. We have an asset management system in place, but there are occasional times where it's offline(Or I am), so I wanted to make something that I could chart these items on, and I wanted to get a little fancy.

So I have a column for things like the user's name, the type of asset, the make/model., etc...

I would like to have the date auto-fill with the current date, when I enter something in the 'Name' column, which happens to be 'A'. The 'Date' column is 'B'. So what I'm looking for is when I enter anything in the 'Name' Field(Say the first row is "2", the next one would be "3", etc.), it would autofill in the date column next to it. So, if A2 contains my first user's name, B2 would have today's date. When I enter the next person, then that person's name would be in A3, and B3 would be where that particular date is.

Later, I would do the same for the date when I went back and added it to the asset management system and "closed" that entry, but if I learn how to do the first one, the next one will be easy. Any help would be greatly appreciated.
 

Some videos you may like

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
10,194
Office Version
2007
Platform
Windows
Try this

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Target.Count > 1 Then Exit Sub
  If Target.Column = 1 Then
    If Target.Value = "" Then Exit Sub
    Target.Offset(, 1).Value = Date
  End If
End Sub
SHEET EVENT
Right click the tab of the sheet you want this to work, select view code and paste the code into the window that opens up.

Return to the excel sheet, type something in cell A2, the date will automatically be set in cell B2.
 

MikeyW1969

Board Regular
Joined
Apr 28, 2014
Messages
78
OK, so this one worked beautifully.

For the 'A' column. I figured that i just needed to change the
Code:
If Target.Column = 1 Then
line to '8' or something(For the 8th column), to do the second date entry farther down the list, but that didn't work. What am I missing? Or does having two different areas with the possible date entry completely change the thing?
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
10,194
Office Version
2007
Platform
Windows
OK, so this one worked beautifully.

For the 'A' column. I figured that i just needed to change the
Code:
If Target.Column = 1 Then
line to '8' or something(For the 8th column), to do the second date entry farther down the list, but that didn't work. What am I missing? Or does having two different areas with the possible date entry completely change the thing?
If you want it to work for columns A and H and set the date to B and I respectively, then try this:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Target.Count > 1 Then Exit Sub
  If Not Intersect(Target, Range("A:A, H:H")) Is Nothing Then
    If Target.Value = "" Then Exit Sub
    Target.Offset(, 1).Value = Date
  End If
End Sub
 

MikeyW1969

Board Regular
Joined
Apr 28, 2014
Messages
78
That was perfect! Thanks again.

I love this site, everyone has a different way to approach the issue, and all of the suggestions work. This one will be perfect. Thanks!
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
10,194
Office Version
2007
Platform
Windows
That was perfect! Thanks again.

I love this site, everyone has a different way to approach the issue, and all of the suggestions work. This one will be perfect. Thanks!
I'm glad to help you. Thanks for the feedback.
 

Forum statistics

Threads
1,089,434
Messages
5,408,195
Members
403,188
Latest member
Sanjana Ramesh

This Week's Hot Topics

  • help please
    SORRY NOT ANY GOOD AT EXCEL SO HELP WOULD BE MUCH APPRECIATED this formula is in a sheet called ignore...
  • two formulas needed
    Hello, I'll try my best to explain this: First formula needed in Sheet1 cell A2: If Sheet1 cell B2 = Sheet2 cell B2 then return a 1. If not then...
  • Dynamic Counts
    Good afternoon, we are tidying up some data & the data seems to be growing quicker than we are tidying it up! What we confirm (by reviewing it...
  • Help Excel formula eliminate duplicate values and keep only 2 identical rows.
    as picture below column A has a duplicate value. but the values are not the same as the rule. sometimes 4 rows, sometimes 10 rows or 7 or 9...
  • Macro Compile Error Sub or Function not defined
    Hello, I am trying to run macros from a validation list, all macros have been created and run perfectly on there own but I'm getting a compile...
  • Last row combined with Current Region VBA
    I'm generally happy finding the last row of data through something like Lastrow = Cells(Rows.Count, "D").End(xlUp) but I don't always receive data...
Top