[英]Update Date automatically when I log data
I have been filling out an excel sheet logging project information. 我一直在填写Excel工作表记录项目信息。 I would like to know how to have to populate a cell with the current date when I update cells in the adjacent row in the same sheet.
我想知道在更新同一张纸的相邻行中的单元格时,如何用当前日期填充一个单元格。 There is currently information in the adjacent cells but I want it to hold the date that I previously updated it with.
当前在相邻的单元格中有信息,但我希望它保留以前更新它的日期。 Only when I update the information I want it to change
只有当我更新信息时,我才希望更改它
I have googled for logical operator information but I cannot seem to find a direct answer. 我已经在Google上搜索了逻辑运算符信息,但似乎找不到直接答案。 If there is a VB macro I could I am open to any solutions.
如果有VB宏,我可以接受任何解决方案。 I have found information on the TODAY() function in excel as well but I do not know how to apply it my particular problem.
我也在Excel中也找到了关于TODAY()函数的信息,但是我不知道如何将其应用于我的特定问题。 Any references to VB macros or information would be helpful.
对VB宏或信息的任何引用都将有所帮助。 Thank you.
谢谢。
Try this, Alt-F11 to launch the editor, right-click "Sheet1" (or your sheet name) and select add code, paste in something like this: 尝试使用Alt-F11来启动编辑器,右键单击“ Sheet1”(或您的工作表名称),然后选择添加代码,并粘贴如下内容:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
Set KeyCells = Range("B2:B10")
If Not Application.Intersect(KeyCells, Range(Target.Address)) Is Nothing Then
Cells(Target.Row, Target.Column - 1) = Now()
End If
End Sub
If you type something into B2 to B10 then the adjacent column is updated with the current date. 如果在B2到B10中键入内容,则相邻列将使用当前日期更新。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.