(若是和其他不同软件互动之问题 请记得一并填写)
软件:excel
版本:2019
Public Function test1(PROD As String) As Integer
Dim wsFunc As WorksheetFunction: Set wsFunc =
Application.WorksheetFunction
Dim ws As Worksheet: Set ws = Sheets("Sheets1")
Dim rngLook As Range: Set rngLook = ws.Range("A1:B10")
Dim target_name As String
Dim value As String
On Error Resume Next
value = wsFunc.VLookup(PROD, rngLook, 2, False)
test1 = value
End Function
一直卡在黄字 阵列索引超出范围
我是想写一个变量带入
如果是 苹果 值=10
香蕉 值=20
前面会抓一个字串
fruit = 香蕉
Dim retVal As Integer
retVal = test1("fruit")
不知道该怎么改