Tag: 继续

继续TypeMismatch 2042错误的下一次迭代

我在VBA中寻找Continue语句。 我find了一个VB.NET解决scheme,但Excel“IDE”不能识别它。 http://msdn.microsoft.com/en-us/library/801hyx6f.aspx 如果发生错误,我想跳过迭代。 有没有其他的方法 – 一个更优雅的解决scheme – 但GOTO(这是最糟糕的情况下)或包装整个小组在if语句(这也无助于可读性)? 代码片段 'While Loop…. For Each C In w.Range(w.Cells(1, 1), w.Cells(num_rw, num_col)) If IsError(C.Value) Then: MsgBox ("File unsuitable!") 'Continue While End If If Var1 <> "" Then If C.Value = Var1 Then: _ Set Var1_Range = w.Range(w.Cells(C.Row, C.Column), w.Cells(num_rw, C.Column)) End If If Var2 <> "" Then […]