在此行出现错误
Finalrow = Cells(Row.Count, 1).End(X1UP).Row
错误是
对象所需的运行时错误424。
下面是代码
Sub MyVlookup()
Dim r As Long, C As Long, Col_index As Long
Finalrow = Cells(Row.Count, 1).End(X1UP).Row
Col_index = 2
For I = 2 To Finalrow
For C = 2 To 4
Cells(I, C).Value = Application.VLookup(Cells(I, 2), Range("B2:G2"), Col_index, False)
Col_index = Col_index + 1
Next C
Next I
End Sub
答案 0 :(得分:1)
Finalrow = Cells(Rows.Count, 1).End(X1UP).Row
错误发生在X1UP
上,我明白了您尝试执行的操作,但实际上是XlUp
,因此,L而不是1 :)应该可以使用
Finalrow = Cells(Rows.Count, 1).End(XlUp).Row