为什么直到最后使用的行都没有用正确的值填充列(OOKUP函数)?

时间:2018-09-12 11:55:06

标签: excel vba

我有下面的代码,我不明白为什么会出现运行时错误1004:应用程序定义的错误或对象定义的错误。

Sub INCA_tabel()


Dim lastrow As Long

Sheets("Calibr").Activate

lastrow = Cells(Rows.count, 2).End(xlUp).Row
Range("B2:B" & lastrow).Select
Selection.copy
Sheets("INCA").Select
Range("C3:C" & lastrow).PasteSpecial Paste:=xlPasteValues


Sheets("INCA").Activate
lastrow = ActiveSheet.Cells(Rows.count, "C").End(xlUp).Row
ActiveSheet.Range("B2:B" & lastrow).Formula = "=LOOKUP(C3; Calibr!B:B; Calibr!C:C)" <-- here is the issue

ActiveSheet.Cells(lastrow, "A").value = "INCA_Read"

End Sub

谢谢!

1 个答案:

答案 0 :(得分:0)

替换;与,

ActiveSheet.Range("B2:B" & lastrow).Formula = "=LOOKUP(C3, Calibr!B:B, Calibr!C:C)"