回答編集履歴
2
けしわすれ
test
CHANGED
@@ -68,11 +68,7 @@
|
|
68
68
|
|
69
69
|
function handleType2toSetDate(currentRange, next) {
|
70
70
|
|
71
|
-
Logger.log(currentRange.getColumn());
|
72
|
-
|
73
71
|
if(currentRange.getColumn() != 6) { return; }
|
74
|
-
|
75
|
-
Logger.log(next.getValue());
|
76
72
|
|
77
73
|
next.setValue(getCurrentTime());
|
78
74
|
|
1
じかんがたった
test
CHANGED
@@ -35,3 +35,67 @@
|
|
35
35
|
}
|
36
36
|
|
37
37
|
```
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
--- 追記
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
```javascript
|
46
|
+
|
47
|
+
//https://teratail.com/questions/132061
|
48
|
+
|
49
|
+
function onEdit(e) {
|
50
|
+
|
51
|
+
var sheetName = e.source.getSheetName();
|
52
|
+
|
53
|
+
if(sheetName === "テスト1") { handleType1toSetDate(e.range, e.range.getNextDataCell(SpreadsheetApp.Direction.DOWN)); }
|
54
|
+
|
55
|
+
if(sheetName === "テスト2") { handleType2toSetDate(e.range, e.range.getNextDataCell(SpreadsheetApp.Direction.NEXT)); }
|
56
|
+
|
57
|
+
return;
|
58
|
+
|
59
|
+
}
|
60
|
+
|
61
|
+
function handleType1toSetDate(currentRange, underneath) {
|
62
|
+
|
63
|
+
if(!currentRange.isPartOfMerge() || !underneath.isPartOfMerge()) { return; }
|
64
|
+
|
65
|
+
underneath.setValue(getCurrentTime());
|
66
|
+
|
67
|
+
}
|
68
|
+
|
69
|
+
function handleType2toSetDate(currentRange, next) {
|
70
|
+
|
71
|
+
Logger.log(currentRange.getColumn());
|
72
|
+
|
73
|
+
if(currentRange.getColumn() != 6) { return; }
|
74
|
+
|
75
|
+
Logger.log(next.getValue());
|
76
|
+
|
77
|
+
next.setValue(getCurrentTime());
|
78
|
+
|
79
|
+
}
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
function getCurrentTime() {
|
84
|
+
|
85
|
+
var ctime = new Date();
|
86
|
+
|
87
|
+
var MM = ctime.getMonth()+1;
|
88
|
+
|
89
|
+
var dd = ctime.getDate();
|
90
|
+
|
91
|
+
var hh = ctime.getHours();
|
92
|
+
|
93
|
+
var mm = ctime.getMinutes();
|
94
|
+
|
95
|
+
var t = MM+"/"+dd+"_"+hh+":"+mm+"発表";
|
96
|
+
|
97
|
+
return t;
|
98
|
+
|
99
|
+
}
|
100
|
+
|
101
|
+
```
|