我正在努力让以下工作:
it('should do set data when the controller loads', function() {
$timeout.verifyNoPendingTasks();
expect(ctrl.data)toEqual(mockResolvedData);
})
答案 0 :(得分:1)
实际的工作表公式看起来不错,但在VBA中尝试VLOOKUP function时,您应该防范可怕的#N/A
无匹配错误。
Dim cell As Range, wsP1 As Worksheet
Set wsP1 = Worksheets("p1")
With Worksheets("n1")
For Each cell In .Range("A3:A2000")
If Not IsError(.Range("AT" & cell.Row - 1)) And _
Not IsError(Application.VLookup(.Range("AT" & cell.Row - 1), wsP1.Range("A:E"), 5, False)) Then
If .Range("AT" & cell.Row - 1) = "N/A" Or _
.Range("AT" & cell.Row - 1) = Application.VLookup(.Range("AT" & cell.Row - 1), wsP1.Range("A:E"), 5, False) Then
[Do something]
Else
[do something else]
End If
Else
cell = "there is a worksheet error"
Debug.Print "there is a worksheet error"
End If
Next cell
End With
我通过为变量分配一个工作表并为另一个使用With...End With statement来加强代码的可读性。您至少有两个地方没有引用 AT 列引用。