有没有办法从excel VBA中的用户定义函数(非宏)读取另一个工作簿中的数据?
答案 0 :(得分:0)
是的,尝试引用Workbook
这样的
Function Plus5(Wkb as Workbook, sSheet as String, sRef as String) as Double
'' I'm guessing that is number the data you want
'' Wkb = Workbooks object, sSheet = Sheet Name; sRef = Cell Reference
Dim Wks as Worksheet
Set Wks = Wkb.Worksheets(sSheet)
Plus5 = Wks.Range(sRef) + 5
End Function