![](/img/trans.png)
[英]Unable to get the Match Property of the WorksheetFunction class error
[英]Excel error with match "Unable to get the Match property of the worksheetfunction class"
我正在嘗試在 VBA Excel 中進行匹配,但出現錯誤,我不知道為什么......如果我在工作表中輸入相同的匹配函數,它可以工作,但來自 VBA。
這是一個有問題的片段。
Set id_range = table_m.ListColumns("ID").DataBodyRange
Dim a As Double
MsgBox "looking for ID : " + dep_id + " in range " + id_range.Address
a = WorksheetFunction.Match(dep_id, id_range, 0)
MsgBox a
但是,我得到了臭名昭著的錯誤:
無法獲取工作表函數類的匹配屬性
如果我手動輸入 Excel 單元格Match(1,$A$7:$A$8,0)
它確實有效,但 VBA 似乎不喜歡它。
問題是dep_id是一個字符串,但我的范圍值被格式化為 General 所以它被認為是Integer
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.