2

とにかく、Excel(VBA)で関数VLOOKUPのソースコードを見つけて変更できるようにすることはできますか?グーグルは私に助けを与えません。ありがとう!

4

3 に答える 3

7

Excel / VBAはオープンソースではないため、特定の関数のソースコードは利用できません。

VBAで独自のUDF(ユーザー定義関数)を記述して、変更したバージョンを作成できます。

http://www.cpearson.com/Excel/FlexLookup.aspxには、より柔軟な(VBA以外の)バージョンのVLOOKUP/HLOOKUPもあります。

于 2012-09-14T02:35:22.487 に答える
0

私にはうまくいかなかったVahidの答えに基づいて、私はうまくいった次のコードを実行しました。

Function CUSTOMVLOOKUP(lookup_value As String, table_array As Range, col_index_num As Integer)
    Dim i As Long
    For i = 1 To table_array.Rows.Count
        If lookup_value = table_array.Cells(i, 1) Then
            CUSTOMVLOOKUP = table_array.Cells(i, col_index_num)
            Exit For
        End If
    Next i
End Function
于 2017-06-02T13:33:37.670 に答える
-2

これはVlookupの単純な実装です。

        Public Function VLOOKUP1(ByVal lookup_value As String, ByVal table_array As Range, ByVal col_index_num As Integer) As String
        Dim i As Long

        For i = 1 To table_array.Rows.Count
            If lookup_value = table_array.Cells(table_array.Row + i - 1, 1) Then
                VLOOKUP1 = table_array.Cells(table_array.Row + i - 1, col_index_num)
                Exit For
            End If
        Next i

        End Function
于 2016-10-31T12:01:13.787 に答える