ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   range of cells (https://www.excelbanter.com/excel-programming/300175-range-cells.html)

del

range of cells
 
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.

keepITcool

range of cells
 

if not intersect (Activecell,[b4:c11]) is nothing then
msgbox "gotcha!"
endif

keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"del" wrote:

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.



Chip Pearson

range of cells
 
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



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





All times are GMT +1. The time now is 10:45 PM.

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