回答編集履歴
1
追記
test
CHANGED
@@ -24,13 +24,13 @@
|
|
24
24
|
|
25
25
|
For i = 2 To .Rows.Count
|
26
26
|
|
27
|
-
n = .Cells(i, 1).Value
|
27
|
+
n = .Cells(i, 1).Value '名前
|
28
28
|
|
29
|
-
Set dest = Worksheets(.Cells(i, 3).Value)
|
29
|
+
Set dest = Worksheets(.Cells(i, 3).Value) '所属(転記先シート)
|
30
30
|
|
31
|
-
r = dest.UsedRange.SpecialCells(xlCellTypeLastCell).Row + 1
|
31
|
+
r = dest.UsedRange.SpecialCells(xlCellTypeLastCell).Row + 1 '転記先の行番号
|
32
32
|
|
33
|
-
dest.Range("A" & r).Value = n
|
33
|
+
dest.Range("A" & r).Value = n 'ソート用
|
34
34
|
|
35
35
|
.Rows(i).Copy dest.Cells(r, 2)
|
36
36
|
|
@@ -52,11 +52,11 @@
|
|
52
52
|
|
53
53
|
If WorksheetFunction.CountIf(dest.Columns(1), n) = 0 Then
|
54
54
|
|
55
|
-
r = dest.UsedRange.SpecialCells(xlCellTypeLastCell).Row + 1
|
55
|
+
r = dest.UsedRange.SpecialCells(xlCellTypeLastCell).Row + 1
|
56
56
|
|
57
57
|
Else
|
58
58
|
|
59
|
-
r = WorksheetFunction.Match(n, dest.Columns(1), 0)
|
59
|
+
r = WorksheetFunction.Match(n, dest.Columns(1), 0) '既にある場合はその行
|
60
60
|
|
61
61
|
End If
|
62
62
|
|
@@ -72,7 +72,7 @@
|
|
72
72
|
|
73
73
|
|
74
74
|
|
75
|
-
For Each dest In Worksheets
|
75
|
+
For Each dest In Worksheets 'ソート用のワーク列をクリア
|
76
76
|
|
77
77
|
If dest.Name <> zen.Name And dest.Name <> tou.Name Then dest.Columns(1).ClearContents
|
78
78
|
|