-2

私はこの式を使用します:

=IFERROR(IF(MATCH(transf(E7);transf(Sheet2!$C$2:$C$66648);0)>0;"YES");"no")

transfセル内の実際のテキスト値を小文字に変換/変換し、他のことを行うUDFです(この質問の主題ではありません)。

通常、transf(E7)形成された配列内で の値が見つかった場合transf(Sheet2!$C$2:$C$66648)、式は を返します。YESno

UDF 自体はうまく機能し、何度もテストされています。問題は、今回は機能しないことです。返された答えはnoで、正しくありません。この数式の失敗は、66,000 個以上のアイテムの大きな配列に関連していますか? 配列数式として使用される UDF の制限は何ですか?

編集1

これは私の UDF の簡易版です。

Public Function transf(ByVal vText As Variant) As Variant
Dim aText() As Variant
Dim j As Long
    On Error GoTo ErrH

    If TypeName(vText) = "String" Then
        '...some code...
    ElseIf TypeName(vText) = "Variant()" Then
        '...some code...
    ElseIf TypeName(vText) = "Range" Then   ' <<< both instances of the UDF fall here
        ReDim aText(1 To vText.Count)
        For j = 1 To vText.Count
            aText(j) = Trim(LCase(vText(j)))
        Next
        transf = Application.Transpose(aText)   ' <<< this line causes an error 13
    Else
        transf = CVErr(xlErrValue)
    End If
ErrH:
    'This was created not for the current case, but the error the UDF gets has the same #
    If Err.Number = 13 Then
        Err.Clear
        Resume Next
    End If

End Function

パフォーマンスの場合に他の欠陥に気付いた場合は、お知らせください。

編集2

Excel 2010 を使用しています。互換モードはありません。ファイル自体は .xlsm、UDF は .xlam アドイン ファイルにあります。

4

1 に答える 1