Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel 运行时错误13处理-继续循环_Excel_Vba - Fatal编程技术网

Excel 运行时错误13处理-继续循环

Excel 运行时错误13处理-继续循环,excel,vba,Excel,Vba,我有一个VBA for循环,偶尔会得到一个运行时错误13,我想用增量I来处理 我试图处理该错误,但它仍然抛出运行时错误13 For i = 2 To lastRow On Error GoTo stringNotFound strString = (ws.Cells(i, 2).Value) 'get value of cell ' Do other stuff stringNotFound: Next i 我如何处理它,以便在发生错误时跳过单元格并递增I Fo

我有一个VBA for循环,偶尔会得到一个运行时错误13,我想用增量I来处理

我试图处理该错误,但它仍然抛出运行时错误13

For i = 2 To lastRow
    On Error GoTo stringNotFound
    strString = (ws.Cells(i, 2).Value) 'get value of cell
    ' Do other stuff
    stringNotFound:
Next i
我如何处理它,以便在发生错误时跳过单元格并递增I

For i = 2 To lastRow
    If IsError(ws.Cells(i, 2)) = False Then
        strString = (ws.Cells(i, 2).Value)    'get value of cell
        ' Do other stuff
    End If
Next i