Test to see if a cell is within a range

  • Thread starter Thread starter Tim Coddington
  • Start date Start date
T

Tim Coddington

What is the best way to define a range and then use it to test to see if a
cell is within that range? Something like ...

dim rngMine as range
set rngMine = range("$D$3", "$D$4", "$E$3:$F$41")
If activecell.address in rngMine then ...
 
Tim ,

You won't be able to set the range like that

Dim rngMine As Range
Set rngMine = Range("$D$3, $D$4, $E$3:$F$41")
If Not Intersect(ActiveCell, rngMine) Is Nothing Then
MsgBox "found"
End If


--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Thanks for the help!
Bob Phillips said:
Tim ,

You won't be able to set the range like that

Dim rngMine As Range
Set rngMine = Range("$D$3, $D$4, $E$3:$F$41")
If Not Intersect(ActiveCell, rngMine) Is Nothing Then
MsgBox "found"
End If


--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top