Excel VBA Range contém
' 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
VasteMonde