错误:对象变量或未设置块代码

时间:2019-05-20 19:09:59

标签: excel vba excel-vba-mac

代码实际上是在另一本工作簿的某个范围内寻找公式

以下代码为我提供了错误目标代码:在第6行上

With ws1
    i = 6
    Do Until .Cells(i, 3) = ""
        If .Cells(i, 3).Value <> "NA" Then
                Set rngStatus = rngLookup.Find(.Cells(i, 3).Value)
                vCurrYear = rngStatus.EntireRow.Cells(1, 12).Formula
                vPrevYear = rngStatus.EntireRow.Cells(1, 11).Formula
            If Not IsError(v) Then .Cells(i, 5) = vCurrYear And .Cells(i, 4) = vPrevYear
        End If
        i = i + 1
    Loop
End With

0 个答案:

没有答案