vba udf #value错误 [英] vba udf #value errors
本文介绍了vba udf #value错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当
VBA调试器/编辑器甚至没有显示函数时,导致VBA UDF出现#value错误的原因
VBA debugger/editor does not even shows the function
正在解雇一个int?
Public Static Function MonthStringToInteger(MonthRange As Range) As Integer
Application.Volatile
Application.CalculateFull
If MyCalls = 0 Then
Call InitalizeMonths
End If
MyCalls = MyCalls + 1
Dim MatchPos As Integer
Dim MonthInteger As Integer
MonthInteger = 1
Dim MonthString As String
For Each cell In MonthRange
MonthString = cell
Rem Debug.Print cell, MonthString, MonthRange
Next cell
For Each m In Months
MatchPos = InStr(1, MonthString, m, vbTextCompare)
If MatchPos > 0 Then
Rem Debug.Print MyCalls, MonthString, m, MatchPos, MonthInteger
Rem Debug.Print MyCalls, MonthString, MonthInteger
GoTo scram
End If
MonthInteger = MonthInteger + 1
Next m
'no match found
Debug.Print MyCalls, MonthString, MonthStringToInteger
MonthStringToInteger = 0
Return
scram:
Debug.Print MyCalls, MonthString, MonthStringToInteger
MonthStringToInteger = MonthInteger
End Function
推荐答案
单元格和m未声明。
MyCalls和Months未定义/声明。
cell and m are not declared.
MyCalls and Months are not defined/declared.
'---
Jim Cone
美国俄勒冈州波特兰市
http://www.mediafire.com/PrimitiveSoftware
(XL Companion加载项: 比较,匹配,计数,列表,查找,删除......)
'---
Jim Cone
Portland, Oregon USA
http://www.mediafire.com/PrimitiveSoftware
(XL Companion add-in: compares, matches, counts, lists, finds, deletes...)
这篇关于vba udf #value错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文