回答編集履歴

1

追記

2022/05/27 02:50

投稿

jinoji
jinoji

スコア4585

test CHANGED
@@ -7,3 +7,36 @@
7
7
  '日づけが一致したら
8
8
  If kintaideta.Cells(i, 7) = MyList(j, 1) Then
9
9
  ```
10
+
11
+
12
+ ---
13
+ <追記>
14
+ こんな感じでしょうか。
15
+ ```
16
+ Set Renrakuhyou = Worksheets("連絡表")
17
+ Set Kintaidata = Worksheets("勤怠データ")
18
+
19
+ Dim shimei, hiduke, naiyo, jikan
20
+ With Renrakuhyou
21
+ For i = 5 To .Cells(Rows.Count, 4).End(xlUp).Row
22
+ If .Cells(i, 4) <> "" Then
23
+ '連絡表の値取得
24
+ If .Cells(i, 3).Value <> "" Then shimei = .Cells(i, 3).Value
25
+ hiduke = .Cells(i, 4).Value
26
+ naiyo = .Cells(i, 5).Value
27
+ jikan = .Cells(i, 8).Value
28
+
29
+ '勤怠データシートに転記
30
+ With Kintaidata
31
+ For j = 2 To .Cells(.Rows.Count, 4).End(xlUp).Row
32
+ If .Cells(j, 5).Value = shimei And .Cells(j, 7).Value = hiduke Then
33
+ .Cells(j, 11).Value = naiyo
34
+ .Cells(j, 12).Value = jikan
35
+ End If
36
+ Next
37
+ End With
38
+ End If
39
+ Next
40
+ End With
41
+
42
+ ```