我有一个按钮,它会查看所选单元格的文本并引用不同表格中的表格以返回姓氏,名字。这就是我所拥有的:
Sub button1()
Dim name As String
Dim ArrayRange As Range
Dim ActCell As Range
Set ActCell = ActiveCell
Sheets("Results").Select
Set ArrayRange = Sheets("Results").Range("A1", Range("A1").End(xlToRight).End(xlDown))
Sheets(1).Select
Lastname = Application.WorksheetFunction.VLookup(ActCell.Value, ArrayRange, 13, False)
FirstName = Application.WorksheetFunction.VLookup(ActCell.Value, ArrayRange, 12, False)
MsgBox Lastname & FirstName
End Sub
我收到错误
无法获取WorksheetFunction类的vLookup属性
非常感谢任何帮助!