range of cells

D

del

how do you check if a cell falls under a a range of
cells. in other words, check if a cell is within a
particular range.
i tried using strcomp on the addresses but it didn't work.
 
C

Chip Pearson

Del,

You can use the Intersect method to determine if a cell is in
another range of cells. E.g.,

Dim Rng As Range
Set Rng = Range("C3")
If Not Application.Intersect(Rng, Range("A1:D4")) Is Nothing Then
Debug.Print "In Range"
Else
Debug.Print "Out of range"
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Top