Answers for "excel vba range contains"

VBA
0

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
Posted by: Guest on January-25-2021

Code answers related to "VBA"

Browse Popular Code Answers by Language