Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Cell lies within range

I think I have seen an elegant way of determining if a particular cell lies
within a particular range. eg. does cell(x,y) lie inside range(a:b)

Any ideas?

Thanks, Kaval
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Cell lies within range

Kaval,

MsgBox Not (Intersect(Cells(x, y), Range("a:b")) Is Nothing)

HTH,
Bernie
MS Excel MVP


"Kaval" wrote in message
...
I think I have seen an elegant way of determining if a particular cell lies
within a particular range. eg. does cell(x,y) lie inside range(a:b)

Any ideas?

Thanks, Kaval



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Cell lies within range

For example:

MsgBox Not Intersect (Range("A1"), Range("A2:Z100")) Is Nothing

--

Vasant

"Kaval" wrote in message
...
I think I have seen an elegant way of determining if a particular cell

lies
within a particular range. eg. does cell(x,y) lie inside range(a:b)

Any ideas?

Thanks, Kaval



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Cell lies within range

Hi Kaval,

Try something like:

Sub Tester09()
Dim rng As Range
Dim rcell As Range

Set rng = Range("TEST")
Set rcell = Range("A2")

If Not Intersect(rcell, rng) Is Nothing Then
MsgBox rcell.Address(0, 0) & " lies in the named " _
& rng.Name.Name & " range"
Else
'It does not!

End If

End Sub

---
Regards,
Norman



"Kaval" wrote in message
...
I think I have seen an elegant way of determining if a particular cell lies
within a particular range. eg. does cell(x,y) lie inside range(a:b)

Any ideas?

Thanks, Kaval



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Data That Lies Between Two Dates Bazy2k Excel Discussion (Misc queries) 1 December 12th 08 10:43 AM
How to make cell width different than the column width it lies in John Excel Discussion (Misc queries) 2 September 11th 06 10:41 PM
Finding the cell in which an object lies F*SH Charts and Charting in Excel 2 July 19th 06 09:33 AM
Range.Find returns cell outside of range when range set to single cell Frank Jones Excel Programming 12 June 10th 04 04:22 AM
Making a connection: shape clicked and cell it lies over. Gazza Excel Programming 2 February 12th 04 02:26 PM


All times are GMT +1. The time now is 06:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"