
[VBA] Array.Contain(특정 값이 배열안에 있는지 확인)
·
[VBA]
vba 배열에 특정값이 있는지 확인하는 방법은 아래와 같다. Array변수 자리에 Array 변수를 넣고, 다음 인수값에 찾고자하는 값을 넣으면 된다. UBound(Filter(Array변수, "검색값")) 결과는 없으면 -1, 찾으면 0 으로 나온다. 예제코드 Sub checkArray() Dim arrTest(5) As String arrTest(0) = "가" arrTest(1) = "나" arrTest(2) = "다" arrTest(3) = "라" arrTest(4) = "마" arrTest(5) = "바" Debug.Print UBound(Filter(arrTest, "가")) Debug.Print UBound(Filter(arrTest, "나")) Debug.Print UBound(Filter..