回答編集履歴
1
追記
test
CHANGED
@@ -1 +1,39 @@
|
|
1
1
|
For Each targetcell In Target.Cells とかではどうでしょう。
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
---
|
6
|
+
|
7
|
+
```VBA
|
8
|
+
|
9
|
+
Private Sub Worksheet_Change(ByVal Target As Range)
|
10
|
+
|
11
|
+
For Each Target In Target.Cells
|
12
|
+
|
13
|
+
If Target.Column = 3 Then 'C列に入力がある場合、D列に時間を記録
|
14
|
+
|
15
|
+
If Target.Offset(, 0).Value = "" Then
|
16
|
+
|
17
|
+
Application.EnableEvents = False 'C列を削除した場合、D列は空白となる
|
18
|
+
|
19
|
+
Target.Offset(, 1).Value = ""
|
20
|
+
|
21
|
+
Application.EnableEvents = True
|
22
|
+
|
23
|
+
Else
|
24
|
+
|
25
|
+
Application.EnableEvents = False
|
26
|
+
|
27
|
+
Target.Offset(, 1).Value = Now
|
28
|
+
|
29
|
+
Application.EnableEvents = True
|
30
|
+
|
31
|
+
End If
|
32
|
+
|
33
|
+
End If
|
34
|
+
|
35
|
+
Next
|
36
|
+
|
37
|
+
End Sub
|
38
|
+
|
39
|
+
```
|