0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ExcelVBA 1次元配列内に指定した要素が含まれるか調べる関数

Last updated at Posted at 2021-09-05

配列内に指定した要素が存在するかどうか調べます。
要素が存在すればTrue、そうでなければFalseを返します。

'--- 配列内に要素が存在するか調べる ---
Private Function Is_Exist_In_Array(ByVal Item As Variant, ByRef TargetArray As Variant)

    Dim i As Long

    For i = LBound(TargetArray) To UBound(TargetArray)
        If TargetArray(i) = Item Then
            Is_Exist_In_Array = True
            Exit Function
        End If
    Next i

    Is_Exist_In_Array = False

End Function
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?