EXCEL巨集發生錯誤訊息?

指令碼如下: ------------------------------------------------------------------------------------------------------------- Function RangeByName(name, Optional wbkname = 0) '根據名稱獲得rng,wbkname可指定工作簿, 默認0表示本工作簿 Dim arr If wbkname = 0 Then wbkname = ThisWorkbook.name If name Like "*!*" Then... 顯示更多 指令碼如下:
-------------------------------------------------------------------------------------------------------------
Function RangeByName(name, Optional wbkname = 0)
'根據名稱獲得rng,wbkname可指定工作簿, 默認0表示本工作簿
Dim arr
If wbkname = 0 Then wbkname = ThisWorkbook.name

If name Like "*!*" Then '如果名稱是帶sheet的單元格引用
arr = Split(name, "!")
Set RangeByName = Workbooks(wbkname).Sheets(arr(0)).Range(arr(1))
Else
Set RangeByName = Workbooks(wbkname).Names(name).RefersToRange
End If
End Function
-------------------------------------------------------------------------------------------------------------
更新: 參考程式網址:http://excel880.com/blog/archives/2413
更新 2: 補上該有問題的程式下載位置
http://www.FunP.Net/4426
2 個解答 2