vba if value exists in range
If Not IsError(Application.Match(ValueToSearchFor, RangeToSearchIn, 0)) Then
' String is in range
vba if value exists in range
If Not IsError(Application.Match(ValueToSearchFor, RangeToSearchIn, 0)) Then
' String is in range
excel vba range contains
' Tests if a range contains a value
Sub TestMe()
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets(1)
If Application.WorksheetFunction.CountIf(ws.Range("A2:A10"), _
ws.Range("A1")) = 0 Then
Debug.Print "No match"
Else
Debug.Print "Range contains value " & ws.Range("A1").Cells(1, 1).Value
End If
End Sub
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us