私が遭遇した深刻なシナリオで、スクリプトが完全に障害者になりました。これは次のとおりです。
On Error Resume Next
For IndexSearch = 0 To ArrayListTaskDetails.Count - 1 Step 4
If ArrayListTaskDetails(IndexSearch + 5) <> "" Then
ArrayListTaskDetails(IndexSearch + 2) = ArrayListTaskDetails(IndexSearch + 5)
'Else
'ArrayListTaskDetails(IndexSearch + 2) = DicForProcessEndDate.Item(ob9.Cells(RowCount,1))
End If
Next
If Err Then
Err.Clear
MsgBox(IndexSearch) '4
ArrayListTaskDetails(IndexSearch + 2) = DicForProcessEndDate.Item(ob9.Cells(RowCount,1))
MsgBox(ob9.Cells(RowCount,1)) '47166954
MsgBox(DicForProcessEndDate.Item(47166954)) ' here i am getting its value
MsgBox(DicForProcessEndDate.Item(ob9.Cells(RowCount,1))) ' here i didn't see any value for the key ob9.Cells(RowCount,1). Even "47166954" and ob9.Cells(RowCount,1) are same
End If
On Error GoTo 0
問題が何であるかを理解するのを手伝ってもらえますか?それが本当に問題であり、ここでアプローチを変更することによってそれを解決するのを手伝ってくれるなら。
編集
制御がエラー処理部分に行くArray out of range
ラインからのようにエラーが発生した場合、それは完璧ですが、カウントは。だけ増加します。= 0の場合、例外が発生し、Exceptionブロックでnotの値を取得しているとしましょう。なぜそうなのですか?教えてください!If ArrayListTaskDetails(IndexSearch + 5) <> ""
IndexSearch
4
IndexSearch
IndexSearch
4
0