Excel Vba Range Contains

[Solved] Excel Vba Range Contains | Vb - Code Explorer | yomemimo.com
Question : excel vba range contains

Answered by : vastemonde

' 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

Source : | Last Update : Mon, 01 Feb 21

Answers related to excel vba range contains

Code Explorer Popular Question For Vb