回答編集履歴
3
コード追記
test
CHANGED
@@ -33,3 +33,41 @@
|
|
33
33
|
'後略
|
34
34
|
|
35
35
|
```
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
別案
|
40
|
+
|
41
|
+
---
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
セル範囲の方を For Each でループさせた方がシンプルになりますね。
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
```vba
|
50
|
+
|
51
|
+
'前略
|
52
|
+
|
53
|
+
Dim c As Range
|
54
|
+
|
55
|
+
For Each c In Cells(4, 16).CurrentRegion
|
56
|
+
|
57
|
+
If i > .Count - 1 Then Exit For
|
58
|
+
|
59
|
+
If c = "有" Then
|
60
|
+
|
61
|
+
c.Offset(, 1) = Mid(.Item(i), 15)
|
62
|
+
|
63
|
+
i = i + 1
|
64
|
+
|
65
|
+
End If
|
66
|
+
|
67
|
+
Next
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
'後略
|
72
|
+
|
73
|
+
```
|
2
コード追記
test
CHANGED
@@ -1 +1,35 @@
|
|
1
1
|
ArrayList用の変数と、出力セル指定用の変数を別に用意しないとだめでしょう。
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
```vba
|
6
|
+
|
7
|
+
'前略
|
8
|
+
|
9
|
+
j = 3
|
10
|
+
|
11
|
+
For i = 0 To .Count - 1
|
12
|
+
|
13
|
+
Do
|
14
|
+
|
15
|
+
j = j + 1
|
16
|
+
|
17
|
+
If Cells(j, 16) = "" Then
|
18
|
+
|
19
|
+
Exit For
|
20
|
+
|
21
|
+
ElseIf Cells(j, 16) = "有" Then
|
22
|
+
|
23
|
+
Cells(j, 17) = Mid(.Item(i), 15)
|
24
|
+
|
25
|
+
Exit Do
|
26
|
+
|
27
|
+
End If
|
28
|
+
|
29
|
+
Loop
|
30
|
+
|
31
|
+
Next i
|
32
|
+
|
33
|
+
'後略
|
34
|
+
|
35
|
+
```
|
1
修正
test
CHANGED
@@ -1,23 +1 @@
|
|
1
1
|
ArrayList用の変数と、出力セル指定用の変数を別に用意しないとだめでしょう。
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
```vba
|
6
|
-
|
7
|
-
Dim i As Long, j As Long
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
For i = 0 To .Count - 1
|
12
|
-
|
13
|
-
If Cells(j + 4, 16) = "有" Then
|
14
|
-
|
15
|
-
Cells(j + 4, 17) = Mid(.Item(i), 15)
|
16
|
-
|
17
|
-
j = j + 1
|
18
|
-
|
19
|
-
End If
|
20
|
-
|
21
|
-
Next i
|
22
|
-
|
23
|
-
```
|