我创建了一些带有几个选项的加载项,例如:
它在使用过程中效果很好但是如果我将文件发送给另一个加载项用户,则函数如下所示:
='C:\TrustedVBA\AddRates_1.2.xlam'!ExRate(Q2,L2)
(链接到已添加的工作表)而不是=ExRate(Q2,L2)
知道如何在每台计算机上获得预期的格式(=ExRate(Q2,L2)
)吗?
全功能代码:
Function ExRate(TCurr, TPD As Range) As Variant
Dim TPD_Value As Worksheet
Set TPD_Value = ActiveWorkbook.Worksheets("TPD value")
Dim RateTable As Range
Dim Location1 As Range
Dim ColumnNo As Integer
Select Case TCurr
Case Is = "EUR": ExRate = 1
Case Else
On Error Resume Next
Set RateTable = TPD_Value.Columns("A:AP")
Set Location1 = TPD_Value.Cells.Find(What:=TCurr, LookAt:=xlWhole,
MatchCase:=False, SearchFormat:=False)
ColumnNo = Location1.Column
On Error Resume Next
ExRate = Application.VLookup(TPD, RateTable, ColumnNo, False)
End Select
End Function