質問編集履歴

1

試したこと(For~Next内の処理を別プロシージャにした)を追記

2021/09/09 23:18

投稿

p1123
p1123

スコア0

test CHANGED
File without changes
test CHANGED
@@ -200,6 +200,124 @@
200
200
 
201
201
  ![イメージ説明](605453e2fd6882917fe64cae94ae919a.png)
202
202
 
203
+
204
+
205
+ ・For~Next内の処理を別プロシージャにした
206
+
207
+ ⇒同様のエラーがEnd Subで発生した
208
+
209
+ コード
210
+
211
+ ```VB.Net
212
+
213
+ For r = 0 To TantoCnt - 1
214
+
215
+ If TantoList(r).Substring(2, TantoList(r).Length - 2) = tantosya Then tantosyaID = r
216
+
217
+ TantobetuDataAdd(WriteDatas, Totals, i, r, prusrow, TantoCnt, SyuhoData)
218
+
219
+ Next
220
+
221
+
222
+
223
+ Private Sub TantobetuDataAdd(ByRef WriteDatas(,,) As String, ByRef Totals(,) As Decimal,
224
+
225
+ i As Integer, r As Integer, prusrow As Integer, TantoCnt As Integer, SyuhoData(,) As String)
226
+
227
+ WriteDatas(i + prusrow, SyuturyokuCol.週報コピー担当者 + r, 0) = SyuhoData(i + 2, r + 4)
228
+
229
+ WriteDatas(i + prusrow, SyuturyokuCol.差分担当者 + r + TantoCnt, 0) = SyuhoData(i + 2, r + 4)
230
+
231
+ Try
232
+
233
+ Totals(r, 0) = Decimal.Parse(SyuhoData(i + 2, r + 4))
234
+
235
+ Catch ex As Exception
236
+
237
+ Totals(r, 0) = 0
238
+
239
+ End Try
240
+
241
+
242
+
243
+ Select Case WriteDatas(i + prusrow, SyuturyokuCol.依頼, 0)
244
+
245
+ Case "メンテナンス"
246
+
247
+ MenteB.Zikan(r) += Totals(r, 0)
248
+
249
+ If Totals(r, 0) <> 0 Then MenteB.Kensu(r) += 1
250
+
251
+ Case "消耗部材"
252
+
253
+ SyomoB.Zikan(r) += Totals(r, 0)
254
+
255
+ If Totals(r, 0) <> 0 Then SyomoB.Kensu(r) += 1
256
+
257
+ Case "改善活動"
258
+
259
+ KaizenB.Zikan(r) += Totals(r, 0)
260
+
261
+ If Totals(r, 0) <> 0 Then KaizenB.Kensu(r) += 1
262
+
263
+ Case "物件対応", "物対"
264
+
265
+ TaioB.Zikan(r) += Totals(r, 0)
266
+
267
+ If Totals(r, 0) <> 0 Then TaioB.Kensu(r) += 1
268
+
269
+ Case "K社案件"
270
+
271
+ KsyaB.Zikan(r) += Totals(r, 0)
272
+
273
+ If Totals(r, 0) <> 0 Then KsyaB.Kensu(r) += 1
274
+
275
+ Case "定期校正"
276
+
277
+ TeikiB.Zikan(r) += Totals(r, 0)
278
+
279
+ If Totals(r, 0) <> 0 Then TeikiB.Kensu(r) += 1
280
+
281
+ Case "増産対応"
282
+
283
+ ZosanB.Zikan(r) += Totals(r, 0)
284
+
285
+ If Totals(r, 0) <> 0 Then ZosanB.Kensu(r) += 1
286
+
287
+ End Select
288
+
289
+
290
+
291
+ Try
292
+
293
+ Totals(r, 1) = Decimal.Parse(SyuhoData(i + 2, r + 4 + TantoCnt + 1)) +
294
+
295
+ Decimal.Parse(SyuhoData(i + 2, r + 4 + (TantoCnt * 2) + 2))
296
+
297
+ Catch ex As Exception
298
+
299
+ Totals(r, 1) = 0
300
+
301
+ End Try
302
+
303
+ Totals(r, 2) = Totals(r, 0) - Totals(r, 1)
304
+
305
+ WriteDatas(i + prusrow, SyuturyokuCol.教育指導担当者 + r + (TantoCnt * 2), 0) = Totals(r, 1).ToString
306
+
307
+ KyoikuSidoB.Zikan(r) += Totals(r, 1)
308
+
309
+ If Totals(r, 1) <> 0 Then KyoikuSidoB.Kensu(r) += 1
310
+
311
+ WriteDatas(i + prusrow, SyuturyokuCol.物件対応担当者 + r + (TantoCnt * 3), 0) = Totals(r, 2).ToString
312
+
313
+ End Sub'<<<ここでエラー
314
+
315
+ ```
316
+
317
+ エラー画像
318
+
319
+ ![イメージ説明](e2361663451895026fc4e175263bd79d.png)
320
+
203
321
  ### 補足情報(FW/ツールのバージョンなど)
204
322
 
205
323
  OS:Windows 10 Pro