ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Test to see if a cell is within a range (https://www.excelbanter.com/excel-programming/318006-test-see-if-cell-within-range.html)

Tim Coddington

Test to see if a cell is within a range
 
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 ...



Frank Kabel

Test to see if a cell is within a range
 
Hi
have a look at intersect for this

--
Regards
Frank Kabel
Frankfurt, Germany

"Tim Coddington" schrieb im Newsbeitrag
...
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 ...




Bob Phillips[_6_]

Test to see if a cell is within a range
 
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)


"Tim Coddington" wrote in message
...
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 Coddington

Test to see if a cell is within a range - Thanks
 
Thanks for the help!
"Bob Phillips" wrote in message
...
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)


"Tim Coddington" wrote in message
...
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 ...








All times are GMT +1. The time now is 11:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com