VBA自定义函数在子例程中调用时有效,但在单元格中输入时会出现值错误

时间:2017-10-07 01:42:19

标签: excel-vba vba excel

代码:

Function getValue(pathname, filename, sheet, rng)

If Right(path, 1) <> ":" Then path = path & ":"

Dim rngR1C1, ref As String:
rngR1C1 = Range(rng).Address(, , xlR1C1)

ref = "'" & pathname & "[" & filename & "]" & sheet & "'!" & rngR1C1

getValue = ExecuteExcel4Macro(ref)

End Function

0 个答案:

没有答案