回答編集履歴
2
コードコメント追記
test
CHANGED
@@ -26,19 +26,25 @@
|
|
26
26
|
|
27
27
|
Sub Make_Sortkey()
|
28
28
|
|
29
|
+
Dim iCnt As Integer '処理件数
|
30
|
+
|
29
|
-
Dim iLevel As Integer
|
31
|
+
Dim iLevel As Integer '階層
|
32
|
+
|
33
|
+
|
30
34
|
|
31
35
|
iLevel = 0
|
32
36
|
|
33
37
|
Do
|
34
38
|
|
35
|
-
iCnt = Make_NodeLevel(iLevel)
|
39
|
+
iCnt = Make_NodeLevel(iLevel) '階層の書き込み処理
|
36
40
|
|
41
|
+
|
42
|
+
|
37
|
-
If iCnt = 0 Then Exit Do
|
43
|
+
If iCnt = 0 Then Exit Do '処理されなくなったらループ終了
|
38
44
|
|
39
45
|
|
40
46
|
|
41
|
-
iLevel = iLevel + 1
|
47
|
+
iLevel = iLevel + 1 '階層を1つ深くする
|
42
48
|
|
43
49
|
Loop
|
44
50
|
|
1
コード整理
test
CHANGED
@@ -48,15 +48,9 @@
|
|
48
48
|
|
49
49
|
Function Make_NodeLevel(viLevel As Integer) As Integer
|
50
50
|
|
51
|
-
Dim
|
51
|
+
Dim iCnt As Integer '検出カウンタ
|
52
52
|
|
53
|
-
Dim c2 As Range
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
Dim iCnt As Integer '
|
58
|
-
|
59
|
-
Dim sParent As String '
|
53
|
+
Dim sParent As String '検索する親ノードID
|
60
54
|
|
61
55
|
|
62
56
|
|