函数无法调用?
很奇怪的一个问题,下面有两个函数.上面一个无法调用下面的那个,提示
"ByRef 类型不一致 ",请问错在哪里了?
Function 个人ID号唯一性核查(shtCur As Worksheet, colOfSID As Integer, colOfPID As Integer, colOfMemo As Integer)
Dim shtSrc, shtTgt, shtTmp As Worksheet
Dim rgnSrc, rgnSrcAux, rgnTgt, rgnTgtAux As Range
Dim sSrc, sSrcAux As String
'缓冲
Dim sid(0) As String
Dim pid(0) As String
Call 得到全体ID号列表(sid, pid)
'针对每条记录查询其唯一性
Dim nCnt As Integer
nCnt = GetDataRows(shtCur, colOfSID)
For i = 1 To nCnt
'得到当前行sid,pid
sSrc = shtCur.Cells(i, colOfSID).Text
sSrcAux = shtCur.Cells(i, colOfPID).Text
'设置目标单元格colOfMemo
Set rgnTgt = shtCur.Cells(1, colOfMemo)
'根据查询结果设置目标单元格内容
If (ID号是唯一的(sSrc, sSrcAux, sid, pid)) Then
rgnTgt.Value = "唯一 "
Else
rgnTgt.Value = "重复 "
End If
Next
End Function
Function ID号是唯一的(sidCur As String, pidCur As String, sid() As String, pid() As String) As Boolean
...
End Function
[解决办法]
Dim sSrc, sSrcAux As String
这样定义变量,sSrc是variant
应这么定义
Dim sSrc as string, sSrcAux As String