我在VBA中尝试vlookup。我正在引用同一工作簿中的另一个工作表,但结果是#NAME?
。
Sub MatchNames()
l_row = Worksheets("Lookup").Cells(Rows.Count, 1).End(xlUp).Row
lookup_range = Worksheets("Lookup").Range("A2:E" & l_row)
Final_row = Cells(Rows.Count, 6).End(xlUp).Row
With Range("BG2:BG" & Final_row)
.FormulaR1C1 = "=vlookup(RC[-52],lookup_range, 2, False)"
End With
End Sub
答案 0 :(得分:1)
尝试,
req.body.documents[0] // not working
req.body.documents[0][0] // not working
req.body.documents instanceof Array // false : why?
Range.Address property可以返回整个路径和工作表名称。给予太多不是有害的。
这可能是一种更好的方法。
l_row = Worksheets("Lookup").Cells(Rows.Count, 1).End(xlUp).Row
Set lookup_range = Worksheets("Lookup").Range("A2:E" & l_row) '<~~one edit here
With Range("BG2:BG" & Final_row)
.FormulaR1C1 = "=vlookup(RC[-52]," & lookup_range.address(referencestyle:=xlR1C1, external:=true) & ", 2, False)" '<~~another edit here
End With