回答編集履歴

11

整理

2020/08/04 05:30

投稿

tosi
tosi

スコア553

test CHANGED
@@ -1,6 +1,4 @@
1
- 依頼と少し違う感じかも知れませんが、こんなのではどうでしょうか。
1
+ 依頼と少し違う感じかも知れませんが、こんなのではどうでしょうか。A列に結果書き込まれます。
2
-
3
- A列に結果書き込まれます。定数域の数値を変更して色々遣って見て下さい。
4
2
 
5
3
  ```VBA
6
4
 
@@ -12,13 +10,15 @@
12
10
 
13
11
  Private lCol As Long
14
12
 
15
- Private giRayer As Integer
13
+ Private giLayer As Integer
14
+
15
+ Private giWorkLayerMax As Integer
16
16
 
17
17
  '定数域
18
18
 
19
- Private Const giCountMax As Integer = 5
19
+ Private Const giCountMax As Integer = 10
20
-
20
+
21
- Private Const giRayerMax As Integer = 6
21
+ Private Const giLayerMax As Integer = 3
22
22
 
23
23
  ' ***********************************************
24
24
 
@@ -26,7 +26,9 @@
26
26
 
27
27
  ' ***********************************************
28
28
 
29
- Sub Test_Sample_Miniature()
29
+ Private Sub Test_Sample_Miniature()
30
+
31
+ Dim iX As Integer
30
32
 
31
33
  Range("A:A").Clear
32
34
 
@@ -34,9 +36,19 @@
34
36
 
35
37
  lCol = 1
36
38
 
39
+ For iX = 1 To giLayerMax
40
+
37
- giRayer = 0
41
+ giLayer = 0
42
+
38
-
43
+ giWorkLayerMax = iX
44
+
45
+ lRow = lRow + 1
46
+
47
+ Cells(lRow, lCol) = "(r = " & iX & ")"
48
+
39
- Call 自己参照(0, "")
49
+ Call 自己参照(0, "")
50
+
51
+ Next
40
52
 
41
53
  End Sub
42
54
 
@@ -46,45 +58,229 @@
46
58
 
47
59
  ' ***********************************************
48
60
 
49
- Function 自己参照(iRayer As Integer, strPara As String) As Boolean
61
+ Private Function 自己参照(iLayer As Integer, strPara As String) As Boolean
50
-
62
+
51
- Dim iX As Integer
63
+ Dim iX As Integer
52
-
64
+
53
- Dim intWorkRay As String
65
+ Dim intWorkLay As String
54
66
 
55
67
  Dim strWorkPar As String
56
68
 
57
- giRayer = giRayer + 1
69
+ giLayer = giLayer + 1
58
-
70
+
59
- intWorkRay = giRayer
71
+ intWorkLay = giLayer
60
72
 
61
73
  strWorkPar = strPara
62
74
 
63
75
  For iX = 0 To giCountMax
64
76
 
65
- If giRayer < giRayerMax And iX <> giCountMax Then
77
+ If giLayer < giWorkLayerMax And iX <> giCountMax Then
66
78
 
67
79
  If strWorkPar = "" Then strPara = iX + 1 Else strPara = strWorkPar & "+" & iX + 1
68
80
 
81
+ Call 自己参照(iLayer, strPara)
82
+
83
+ giLayer = giLayer - 1
84
+
85
+ Else
86
+
87
+ If iX <> giCountMax Then
88
+
89
+ lRow = lRow + 1
90
+
91
+ strPara = strWorkPar & "+" & iX + 1
92
+
93
+ Cells(lRow, lCol) = strPara
94
+
95
+ End If
96
+
97
+ End If
98
+
99
+ Next
100
+
101
+ End Function
102
+
103
+ ```
104
+
105
+ (追記)
106
+
107
+ ```VBA
108
+
109
+ Option Explicit
110
+
111
+ '変数域
112
+
113
+ Private lRow As Long
114
+
115
+ Private lCol As Long
116
+
117
+ Private giLayer As Integer
118
+
119
+ Private giWorkLayerMax As Integer
120
+
121
+ '定数域
122
+
123
+ Private Const giCountMax As Integer = 10
124
+
125
+ Private Const giLayerMax As Integer = 3
126
+
127
+ ' ***********************************************
128
+
129
+ ' 開始
130
+
131
+ ' ***********************************************
132
+
133
+ Private Sub Test_Sample_Miniature()
134
+
135
+ Dim iX As Integer
136
+
137
+ Range("A:A").Clear
138
+
139
+ lRow = 0
140
+
141
+ lCol = 1
142
+
143
+ For iX = 1 To giLayerMax
144
+
145
+ giLayer = 0
146
+
147
+ giWorkLayerMax = iX
148
+
149
+ lRow = lRow + 1
150
+
151
+ Cells(lRow, lCol) = "(r = " & iX & ")"
152
+
153
+ Call 自己参照(0, "")
154
+
155
+ Next
156
+
157
+ End Sub
158
+
159
+ ' ***********************************************
160
+
161
+ ' 自己参照
162
+
163
+ ' ***********************************************
164
+
165
+ Private Function 自己参照(iLayer As Integer, strPara As String) As Boolean
166
+
167
+ Dim iX As Integer
168
+
169
+ Dim intWorkLay As String
170
+
171
+ Dim strWorkPar As String
172
+
173
+ giLayer = giLayer + 1
174
+
175
+ intWorkLay = giLayer
176
+
177
+ strWorkPar = strPara
178
+
179
+ For iX = 0 To giCountMax
180
+
181
+ If giLayer < giWorkLayerMax And iX <> giCountMax Then
182
+
183
+ If strWorkPar = "" Then strPara = iX + 1 Else strPara = strWorkPar & "+" & iX + 1
184
+
185
+ Call 自己参照(iLayer, strPara)
186
+
187
+ giLayer = giLayer - 1
188
+
189
+ Else
190
+
191
+ If iX <> giCountMax Then
192
+
193
+ lRow = lRow + 1
194
+
195
+ strPara = strWorkPar & "+" & iX + 1
196
+
197
+ Cells(lRow, lCol) = strPara
198
+
199
+ End If
200
+
201
+ End If
202
+
203
+ Next
204
+
205
+ End Function
206
+
207
+ ```
208
+
209
+ (再追記)
210
+
211
+ ```VBA
212
+
213
+ Option Explicit
214
+
215
+ '変数域
216
+
217
+ Private lRow As Long
218
+
219
+ Private lCol As Long
220
+
221
+ Private gintLayer As Integer
222
+
223
+ '定数域
224
+
225
+ Private Const giCountMax As Integer = 10
226
+
227
+ Private Const giLayerMax As Integer = 3
228
+
229
+ ' ***********************************************
230
+
231
+ ' 開始
232
+
233
+ ' ***********************************************
234
+
235
+ Private Sub Test_Sample_Miniature()
236
+
237
+ Dim iX As Integer
238
+
239
+ Range("A:A").Clear: lRow = 0: lCol = 1
240
+
241
+ For iX = 1 To giLayerMax
242
+
243
+ gintLayer = iX
244
+
245
+ lRow = lRow + 1: Cells(lRow, lCol) = "(r = " & iX & ")"
246
+
247
+ Call 自己参照(1, 1, "")
248
+
249
+ Next
250
+
251
+ End Sub
252
+
253
+ ' ***********************************************
254
+
255
+ ' 自己参照
256
+
257
+ ' ***********************************************
258
+
259
+ Private Function 自己参照(iPLayer As Integer, iPNextCount As Integer, strParam As String) As Boolean
260
+
261
+ Dim iX As Integer
262
+
263
+ Dim iY As Integer
264
+
265
+ Dim MyStr As String
266
+
267
+ For iX = iPNextCount To giCountMax
268
+
269
+ If iPLayer < gintLayer Then
270
+
271
+ If giCountMax > iX Then
272
+
273
+ Call 自己参照(iPLayer + 1, iX + 1, strParam & "+" & iX)
274
+
275
+ End If
276
+
277
+ Else
278
+
279
+ MyStr = strParam & "+" & iX
280
+
69
281
  lRow = lRow + 1
70
282
 
71
- Cells(lRow, lCol) = strPara
283
+ Cells(lRow, lCol) = Mid(MyStr, 2)
72
-
73
- Call 自己参照(iRayer, strPara)
74
-
75
- giRayer = giRayer - 1
76
-
77
- Else
78
-
79
- If iX <> giCountMax Then
80
-
81
- lRow = lRow + 1
82
-
83
- strPara = strWorkPar & "+" & iX + 1
84
-
85
- Cells(lRow, lCol) = strPara
86
-
87
- End If
88
284
 
89
285
  End If
90
286
 
@@ -93,251 +289,3 @@
93
289
  End Function
94
290
 
95
291
  ```
96
-
97
- (追記)
98
-
99
- ```VBA
100
-
101
- Option Explicit
102
-
103
- '変数域
104
-
105
- Private lRow As Long
106
-
107
- Private lCol As Long
108
-
109
- Private giRayer As Integer
110
-
111
- Private giWorkRayerMax As Integer
112
-
113
- '定数域
114
-
115
- Private Const giCountMax As Integer = 10
116
-
117
- Private Const giRayerMax As Integer = 3
118
-
119
- ' ***********************************************
120
-
121
- ' 開始
122
-
123
- ' ***********************************************
124
-
125
- Sub Test_Sample_Miniature()
126
-
127
- Dim iX As Integer
128
-
129
- Range("A:A").Clear
130
-
131
- lRow = 0
132
-
133
- lCol = 1
134
-
135
- For iX = 1 To giRayerMax
136
-
137
- giRayer = 0
138
-
139
- giWorkRayerMax = iX
140
-
141
- lRow = lRow + 1
142
-
143
-    Cells(lRow, lCol) = "(r = " & iX & ")"
144
-
145
- Call 自己参照(0, "")
146
-
147
- Next
148
-
149
- End Sub
150
-
151
- ' ***********************************************
152
-
153
- ' 自己参照
154
-
155
- ' ***********************************************
156
-
157
- Function 自己参照(iRayer As Integer, strPara As String) As Boolean
158
-
159
- Dim iX As Integer
160
-
161
- Dim intWorkRay As String
162
-
163
- Dim strWorkPar As String
164
-
165
- giRayer = giRayer + 1
166
-
167
- intWorkRay = giRayer
168
-
169
- strWorkPar = strPara
170
-
171
- For iX = 0 To giCountMax
172
-
173
- If giRayer < giWorkRayerMax And iX <> giCountMax Then
174
-
175
- If strWorkPar = "" Then strPara = iX + 1 Else strPara = strWorkPar & "+" & iX + 1
176
-
177
- Call 自己参照(iRayer, strPara)
178
-
179
- giRayer = giRayer - 1
180
-
181
- Else
182
-
183
- If iX <> giCountMax Then
184
-
185
- lRow = lRow + 1
186
-
187
- strPara = strWorkPar & "+" & iX + 1
188
-
189
- Cells(lRow, lCol) = strPara
190
-
191
- End If
192
-
193
- End If
194
-
195
- Next
196
-
197
- End Function
198
-
199
- ```
200
-
201
- (再度追記)
202
-
203
- ```VBA
204
-
205
- Option Explicit
206
-
207
- '変数域
208
-
209
- Private lRow As Long
210
-
211
- Private lCol As Long
212
-
213
- Private giRayer As Integer
214
-
215
- Private giWorkRayerMax As Integer
216
-
217
- '定数域
218
-
219
- Private Const giCountMax As Integer = 10
220
-
221
- Private Const giRayerMax As Integer = 3
222
-
223
- ' ***********************************************
224
-
225
- ' 開始
226
-
227
- ' ***********************************************
228
-
229
- Sub Test_Sample_Miniature()
230
-
231
- Dim iX As Integer
232
-
233
- Range("A:A").Clear
234
-
235
- lRow = 0
236
-
237
- lCol = 1
238
-
239
- For iX = 1 To giRayerMax
240
-
241
- giRayer = 0
242
-
243
- giWorkRayerMax = iX
244
-
245
- lRow = lRow + 1
246
-
247
- Cells(lRow, lCol) = "( r = " & iX & " )"
248
-
249
- Call 自己参照(0, "")
250
-
251
- Next
252
-
253
- End Sub
254
-
255
- ' ***********************************************
256
-
257
- ' 自己参照
258
-
259
- ' ***********************************************
260
-
261
- Function 自己参照(iRayer As Integer, strPara As String) As Boolean
262
-
263
- Dim iX As Integer
264
-
265
- Dim intWorkRay As String
266
-
267
- Dim strWorkPar As String
268
-
269
- giRayer = giRayer + 1
270
-
271
- intWorkRay = giRayer
272
-
273
- strWorkPar = strPara
274
-
275
- For iX = 0 To giCountMax
276
-
277
- If giRayer < giWorkRayerMax And iX <> giCountMax Then
278
-
279
- If strWorkPar = "" Then strPara = iX + 1 Else strPara = strWorkPar & "+" & iX + 1
280
-
281
- Call 自己参照(iRayer, strPara)
282
-
283
- giRayer = giRayer - 1
284
-
285
- Else
286
-
287
- If iX <> giCountMax Then
288
-
289
- If strWorkPar = "" Then strPara = iX + 1 Else strPara = strWorkPar & "+" & iX + 1
290
-
291
- If 判定(strPara) = True Then
292
-
293
- lRow = lRow + 1
294
-
295
- Cells(lRow, lCol) = strPara
296
-
297
- End If
298
-
299
- End If
300
-
301
- End If
302
-
303
- Next
304
-
305
- End Function
306
-
307
- ' ***********************************************
308
-
309
- ' 判定
310
-
311
- ' ***********************************************
312
-
313
- Function 判定(strVal As String) As Boolean
314
-
315
- Dim MyArray As Variant
316
-
317
- Dim iX As Integer
318
-
319
- Dim iY As Integer
320
-
321
- MyArray = Split(strVal, "+")
322
-
323
- 判定 = True
324
-
325
- For iX = 0 To UBound(MyArray)
326
-
327
- For iY = iX + 1 To UBound(MyArray)
328
-
329
- If CInt(MyArray(iX)) >= CInt(MyArray(iY)) Then
330
-
331
- 判定 = False
332
-
333
- Exit Function
334
-
335
- End If
336
-
337
- Next
338
-
339
- Next
340
-
341
- End Function
342
-
343
- ```

10

10

2020/08/04 05:30

投稿

tosi
tosi

スコア553

test CHANGED
@@ -216,7 +216,7 @@
216
216
 
217
217
  '定数域
218
218
 
219
- Private Const giCountMax As Integer = 4
219
+ Private Const giCountMax As Integer = 10
220
220
 
221
221
  Private Const giRayerMax As Integer = 3
222
222
 

9

再度追記

2020/08/01 02:39

投稿

tosi
tosi

スコア553

test CHANGED
@@ -197,3 +197,147 @@
197
197
  End Function
198
198
 
199
199
  ```
200
+
201
+ (再度追記)
202
+
203
+ ```VBA
204
+
205
+ Option Explicit
206
+
207
+ '変数域
208
+
209
+ Private lRow As Long
210
+
211
+ Private lCol As Long
212
+
213
+ Private giRayer As Integer
214
+
215
+ Private giWorkRayerMax As Integer
216
+
217
+ '定数域
218
+
219
+ Private Const giCountMax As Integer = 4
220
+
221
+ Private Const giRayerMax As Integer = 3
222
+
223
+ ' ***********************************************
224
+
225
+ ' 開始
226
+
227
+ ' ***********************************************
228
+
229
+ Sub Test_Sample_Miniature()
230
+
231
+ Dim iX As Integer
232
+
233
+ Range("A:A").Clear
234
+
235
+ lRow = 0
236
+
237
+ lCol = 1
238
+
239
+ For iX = 1 To giRayerMax
240
+
241
+ giRayer = 0
242
+
243
+ giWorkRayerMax = iX
244
+
245
+ lRow = lRow + 1
246
+
247
+ Cells(lRow, lCol) = "( r = " & iX & " )"
248
+
249
+ Call 自己参照(0, "")
250
+
251
+ Next
252
+
253
+ End Sub
254
+
255
+ ' ***********************************************
256
+
257
+ ' 自己参照
258
+
259
+ ' ***********************************************
260
+
261
+ Function 自己参照(iRayer As Integer, strPara As String) As Boolean
262
+
263
+ Dim iX As Integer
264
+
265
+ Dim intWorkRay As String
266
+
267
+ Dim strWorkPar As String
268
+
269
+ giRayer = giRayer + 1
270
+
271
+ intWorkRay = giRayer
272
+
273
+ strWorkPar = strPara
274
+
275
+ For iX = 0 To giCountMax
276
+
277
+ If giRayer < giWorkRayerMax And iX <> giCountMax Then
278
+
279
+ If strWorkPar = "" Then strPara = iX + 1 Else strPara = strWorkPar & "+" & iX + 1
280
+
281
+ Call 自己参照(iRayer, strPara)
282
+
283
+ giRayer = giRayer - 1
284
+
285
+ Else
286
+
287
+ If iX <> giCountMax Then
288
+
289
+ If strWorkPar = "" Then strPara = iX + 1 Else strPara = strWorkPar & "+" & iX + 1
290
+
291
+ If 判定(strPara) = True Then
292
+
293
+ lRow = lRow + 1
294
+
295
+ Cells(lRow, lCol) = strPara
296
+
297
+ End If
298
+
299
+ End If
300
+
301
+ End If
302
+
303
+ Next
304
+
305
+ End Function
306
+
307
+ ' ***********************************************
308
+
309
+ ' 判定
310
+
311
+ ' ***********************************************
312
+
313
+ Function 判定(strVal As String) As Boolean
314
+
315
+ Dim MyArray As Variant
316
+
317
+ Dim iX As Integer
318
+
319
+ Dim iY As Integer
320
+
321
+ MyArray = Split(strVal, "+")
322
+
323
+ 判定 = True
324
+
325
+ For iX = 0 To UBound(MyArray)
326
+
327
+ For iY = iX + 1 To UBound(MyArray)
328
+
329
+ If CInt(MyArray(iX)) >= CInt(MyArray(iY)) Then
330
+
331
+ 判定 = False
332
+
333
+ Exit Function
334
+
335
+ End If
336
+
337
+ Next
338
+
339
+ Next
340
+
341
+ End Function
342
+
343
+ ```

8

(追記)

2020/07/31 23:03

投稿

tosi
tosi

スコア553

test CHANGED
@@ -95,8 +95,6 @@
95
95
  ```
96
96
 
97
97
  (追記)
98
-
99
- 求めているのは此方でしょうか。
100
98
 
101
99
  ```VBA
102
100
 

7

Cells(lRow, lCol) = "(r = " & iX & ")"

2020/07/31 21:56

投稿

tosi
tosi

スコア553

test CHANGED
@@ -140,6 +140,10 @@
140
140
 
141
141
  giWorkRayerMax = iX
142
142
 
143
+ lRow = lRow + 1
144
+
145
+    Cells(lRow, lCol) = "(r = " & iX & ")"
146
+
143
147
  Call 自己参照(0, "")
144
148
 
145
149
  Next

6

求めているのは此方でしょうか。

2020/07/31 21:43

投稿

tosi
tosi

スコア553

test CHANGED
@@ -94,6 +94,104 @@
94
94
 
95
95
  ```
96
96
 
97
- p.s.
97
+ (追記)
98
98
 
99
+ 求めているのは此方でしょうか。
100
+
101
+ ```VBA
102
+
103
+ Option Explicit
104
+
105
+ '変数域
106
+
107
+ Private lRow As Long
108
+
109
+ Private lCol As Long
110
+
111
+ Private giRayer As Integer
112
+
99
- 色々と応用出来ます。CellのlColをiRayerに変えると面白いかも・・・・
113
+ Private giWorkRayerMax As Integer
114
+
115
+ '定数域
116
+
117
+ Private Const giCountMax As Integer = 10
118
+
119
+ Private Const giRayerMax As Integer = 3
120
+
121
+ ' ***********************************************
122
+
123
+ ' 開始
124
+
125
+ ' ***********************************************
126
+
127
+ Sub Test_Sample_Miniature()
128
+
129
+ Dim iX As Integer
130
+
131
+ Range("A:A").Clear
132
+
133
+ lRow = 0
134
+
135
+ lCol = 1
136
+
137
+ For iX = 1 To giRayerMax
138
+
139
+ giRayer = 0
140
+
141
+ giWorkRayerMax = iX
142
+
143
+ Call 自己参照(0, "")
144
+
145
+ Next
146
+
147
+ End Sub
148
+
149
+ ' ***********************************************
150
+
151
+ ' 自己参照
152
+
153
+ ' ***********************************************
154
+
155
+ Function 自己参照(iRayer As Integer, strPara As String) As Boolean
156
+
157
+ Dim iX As Integer
158
+
159
+ Dim intWorkRay As String
160
+
161
+ Dim strWorkPar As String
162
+
163
+ giRayer = giRayer + 1
164
+
165
+ intWorkRay = giRayer
166
+
167
+ strWorkPar = strPara
168
+
169
+ For iX = 0 To giCountMax
170
+
171
+ If giRayer < giWorkRayerMax And iX <> giCountMax Then
172
+
173
+ If strWorkPar = "" Then strPara = iX + 1 Else strPara = strWorkPar & "+" & iX + 1
174
+
175
+ Call 自己参照(iRayer, strPara)
176
+
177
+ giRayer = giRayer - 1
178
+
179
+ Else
180
+
181
+ If iX <> giCountMax Then
182
+
183
+ lRow = lRow + 1
184
+
185
+ strPara = strWorkPar & "+" & iX + 1
186
+
187
+ Cells(lRow, lCol) = strPara
188
+
189
+ End If
190
+
191
+ End If
192
+
193
+ Next
194
+
195
+ End Function
196
+
197
+ ```

5

Private

2020/07/31 21:37

投稿

tosi
tosi

スコア553

test CHANGED
@@ -8,17 +8,17 @@
8
8
 
9
9
  '変数域
10
10
 
11
- Public lRow As Long
11
+ Private lRow As Long
12
12
 
13
- Public lCol As Long
13
+ Private lCol As Long
14
14
 
15
- Public giRayer As Integer
15
+ Private giRayer As Integer
16
16
 
17
17
  '定数域
18
18
 
19
- Public Const giCountMax As Integer = 5
19
+ Private Const giCountMax As Integer = 5
20
20
 
21
- Public Const giRayerMax As Integer = 6
21
+ Private Const giRayerMax As Integer = 6
22
22
 
23
23
  ' ***********************************************
24
24
 
@@ -96,6 +96,4 @@
96
96
 
97
97
  p.s.
98
98
 
99
- VBの自己参照見た時には感動しました。
100
-
101
99
  色々と応用出来ます。CellのlColをiRayerに変えると面白いかも・・・・

4

変更

2020/07/30 21:10

投稿

tosi
tosi

スコア553

test CHANGED
@@ -11,10 +11,6 @@
11
11
  Public lRow As Long
12
12
 
13
13
  Public lCol As Long
14
-
15
- Public iY As Integer
16
-
17
- Public giCount As Integer
18
14
 
19
15
  Public giRayer As Integer
20
16
 
@@ -40,8 +36,6 @@
40
36
 
41
37
  giRayer = 0
42
38
 
43
- giCount = 0
44
-
45
39
  Call 自己参照(0, "")
46
40
 
47
41
  End Sub
@@ -55,8 +49,6 @@
55
49
  Function 自己参照(iRayer As Integer, strPara As String) As Boolean
56
50
 
57
51
  Dim iX As Integer
58
-
59
- Dim intCount As Integer
60
52
 
61
53
  Dim intWorkRay As String
62
54
 

3

修正しました。

2020/07/30 04:03

投稿

tosi
tosi

スコア553

test CHANGED
@@ -1,7 +1,3 @@
1
- ≪すみません。結果ダメですね。修正しますので参考程度に見て下さい。≫
2
-
3
-
4
-
5
1
  依頼と少し違う感じかも知れませんが、こんなのではどうでしょうか。
6
2
 
7
3
  A列に結果書き込まれます。定数域の数値を変更して色々遣って見て下さい。
@@ -16,19 +12,17 @@
16
12
 
17
13
  Public lCol As Long
18
14
 
19
- Public iX As Integer
20
-
21
15
  Public iY As Integer
22
16
 
23
- Public iCount As Integer
17
+ Public giCount As Integer
24
18
 
25
- Public iRayer As Integer
19
+ Public giRayer As Integer
26
20
 
27
21
  '定数域
28
22
 
29
- Public Const iCountMax As Integer = 3
23
+ Public Const giCountMax As Integer = 5
30
24
 
31
- Public Const iRayerMax As Integer = 5
25
+ Public Const giRayerMax As Integer = 6
32
26
 
33
27
  ' ***********************************************
34
28
 
@@ -44,19 +38,13 @@
44
38
 
45
39
  lCol = 1
46
40
 
47
- iCount = 0
41
+ giRayer = 0
48
42
 
49
- iRayer = 0
43
+ giCount = 0
50
44
 
51
- For iY = 1 To iRayerMax
52
-
53
- Call 自己参照(0, iCount, "")
45
+ Call 自己参照(0, "")
54
-
55
- Next
56
46
 
57
47
  End Sub
58
-
59
-
60
48
 
61
49
  ' ***********************************************
62
50
 
@@ -64,43 +52,51 @@
64
52
 
65
53
  ' ***********************************************
66
54
 
67
- Function 自己参照(iRayer As Integer, iCount As Integer, strPara As String) As Boolean
55
+ Function 自己参照(iRayer As Integer, strPara As String) As Boolean
68
56
 
69
- Dim strWork As String
57
+ Dim iX As Integer
70
58
 
71
- iRayer = iRayer + 1
59
+ Dim intCount As Integer
72
60
 
73
- strWork = strPara
61
+ Dim intWorkRay As String
74
62
 
75
- If iRayer < iRayerMax Then
63
+ Dim strWorkPar As String
76
64
 
77
- lRow = lRow + 1
65
+ giRayer = giRayer + 1
78
66
 
79
- iCount = iCount + 1
67
+ intWorkRay = giRayer
80
68
 
81
- If strPara = "" Then strPara = iCount Else strPara = strPara & "+" & iCount
69
+ strWorkPar = strPara
82
70
 
83
- Cells(lRow, lCol) = strPara
71
+ For iX = 0 To giCountMax
84
72
 
85
- Call 自己参照(iRayer, 0, strPara)
73
+ If giRayer < giRayerMax And iX <> giCountMax Then
86
74
 
87
- End If
88
-
89
- If iRayer > 1 Then
90
-
91
- For iX = iCount To iCountMax - 1
75
+ If strWorkPar = "" Then strPara = iX + 1 Else strPara = strWorkPar & "+" & iX + 1
92
76
 
93
77
  lRow = lRow + 1
94
78
 
95
- iCount = iCount + 1
79
+ Cells(lRow, lCol) = strPara
96
80
 
97
- Cells(lRow, lCol) = strWork & "+" & iCount
81
+ Call 自己参照(iRayer, strPara)
98
82
 
99
- Next
83
+ giRayer = giRayer - 1
100
84
 
101
- End If
85
+ Else
102
86
 
87
+ If iX <> giCountMax Then
88
+
103
- iRayer = iRayer - 1
89
+ lRow = lRow + 1
90
+
91
+ strPara = strWorkPar & "+" & iX + 1
92
+
93
+ Cells(lRow, lCol) = strPara
94
+
95
+ End If
96
+
97
+ End If
98
+
99
+ Next
104
100
 
105
101
  End Function
106
102
 

2

参考

2020/07/30 03:59

投稿

tosi
tosi

スコア553

test CHANGED
@@ -1,4 +1,4 @@
1
- -すみません。結果ダメですね。修正しますので暫くお待ち下さい。-
1
+ ≪すみません。結果ダメですね。修正しますので参考程度に見て下さい。≫
2
2
 
3
3
 
4
4
 

1

修正

2020/07/30 02:39

投稿

tosi
tosi

スコア553

test CHANGED
@@ -1,3 +1,7 @@
1
+ ≪-すみません。結果ダメですね。修正しますので暫くお待ち下さい。-≫
2
+
3
+
4
+
1
5
  依頼と少し違う感じかも知れませんが、こんなのではどうでしょうか。
2
6
 
3
7
  A列に結果書き込まれます。定数域の数値を変更して色々遣って見て下さい。