填充单元格时的自动时间戳 [英] Automatic timestamp when a cell is filled out

查看:120
本文介绍了填充单元格时的自动时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常简单的excel公式,它的工作原理是因为我可以限制递归迭代。我不是很熟练的脚本,但这是它是什么,它的作品。



= IF(D24 =P,IF(E24 =,DateStamp,E24),IF(D24 =F,IF(E24 =,DateStamp,E24),))



它是一个通过/失败的测试工作表,它会在有人通过或失败的测试时添加一个时间戳。我们还添加了更多的人,我想将文档移动到谷歌应用程序,以允许超过1人同时处理。



唯一的我进来的问题是这个引起的循环引用。在excel中,我可以限制选项中的迭代次数,我没有这个能力了。任何帮助都会很棒。



编辑:我试过的
我试图找到一种方法来输入一个同事创建的VBA脚本,这将为我工作。我不是很好的脚本,所以我无法使这成为一个谷歌应用程序脚本:



VBA SCRIPT:

  Private Sub Worksheet_Change(ByVal Target As Range)

如果Target.Column = 4然后
如果Cells(Target.Row,5) .Value =然后

Cells(Target.Row,5).Value = Now
End If
Else
End If


End Sub

理论上我试图创建一个脚本,将复制一个单元格有一个时间戳,然后尝试粘贴特殊,并将值粘贴到所需的单元格中。这将工作,除非我无法找到一个方法来粘贴特殊的谷歌应用程序脚本。



感谢任何帮助
/编辑

解决方案

Stackoverflow是一个提出与编程有关的问题的地方,例如你实际在做。不是真的要求别人为你开发,即使你甚至没有开始尝试任何Apps脚本代码。我建议您阅读其教程指南。这真的很容易启动。



无论如何,只是为了帮助您开始,我会删除您所说的一切,并坚持问题标题:一个单元格的自动时间戳填写



我建议您在应用脚本上完成所有操作,并完全删除公式,例如



< pre class =lang-js prettyprint-override> function onEdit(){
var s = SpreadsheetApp.getActiveSheet();
if(s.getName()==Sheet1){//检查我们在正确的表单
var r = s.getActiveCell();
if(r.getColumn()== 4){//检查列
var nextCell = r.offset(0,1);
if(nextCell.getValue()==='')//是空的?
nextCell.setValue(new Date());
}
}
}

来自你的,它是:如果在 D 和列 E 列编辑了某些东西,则将当前日期添加到 E


I have an excel formula that is very simple and it works because I can restrict the recursive iterations. I am not very script savvy, but this is what it is and it works.

=IF(D24="P",IF(E24="",DateStamp,E24),IF(D24="F",IF(E24="",DateStamp,E24),""))

Its a pass/fail testing sheet and it adds a timestamp when someone passes or fails the test. We've added a few more people and I want to move the document to google apps to allow more than 1 person to work on it at the same time.

The only issue i've come in is the circular reference that this causes. In excel I can limit the # of iterations in the options, I dont have this ability anymore. Any help would be great.

EDIT: What I've tried. I've tried to find a way to input a VBA Script that a coworker created that would work for me. I'm not good with scripting so I'm unable to make this into a google apps script:

VBA SCRIPT:

    Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Column = 4 Then
If Cells(Target.Row, 5).Value = "" Then

Cells(Target.Row, 5).Value = Now
End If
Else
End If


End Sub

In theory I tried to create a script that will copy a cell that has a timestamp on it and then try to 'paste special' and just paste the value into the cell needed. This would work except I was unable to find a way to paste special with the google apps scripting.

Thanks for any help /edit

解决方案

Stackoverflow is a place to ask questions related to programming, e.g. that you're actually working on. Not really asking for others to develop it for you, i.e. you didn't even started trying any Apps Script code yet. I recommend you reading its tutorials and guides. It's really easy to start.

Anyway, just to help you get started, I'll drop everything you said and stick to the question title: "automatic timestamp when a cell is filled out"

I advise you to do it all on apps script, and drop your formulas entirely, e.g.

function onEdit() {
  var s = SpreadsheetApp.getActiveSheet();
  if( s.getName() == "Sheet1" ) { //checks that we're on the correct sheet
    var r = s.getActiveCell();
    if( r.getColumn() == 4 ) { //checks the column
      var nextCell = r.offset(0, 1);
      if( nextCell.getValue() === '' ) //is empty?
        nextCell.setValue(new Date());
    }
  }
}

This code does what I understood from yours, which is: if something is edited on column D and column E is empty, add the current date to E.

这篇关于填充单元格时的自动时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆