Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Cell is a Member of a range or Not

I have defined a named range. I want to use VBA Code to know whether
particular address from sheet is a member of the defined named range o
not ?

Thanks in advance.

Prasad Josh

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Cell is a Member of a range or Not

Hi
try the following (assumption: you have defined the name
'test_sect_name')
....
if intersect(Range("test_sect_name"),Range("A1")) is nothing then
msgbox "cell A1 not within name"
else
msgbox "cell A1 within name"
end if

--
Regards
Frank Kabel
Frankfurt, Germany

I have defined a named range. I want to use VBA Code to know whether

a
particular address from sheet is a member of the defined named range
or not ?

Thanks in advance.

Prasad Joshi


---
Message posted from http://www.ExcelForum.com/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 218
Default Cell is a Member of a range or Not

Change ActiveCell to the desired cell and "myRange" to the
correct name.

Sub XXXX()
Dim IsInRange As Boolean
If Not Intersect(ActiveCell, Range("myRange")) _
Is Nothing Then IsInRange = True
MsgBox IsInRange
End Sub

Regards,
Greg

-----Original Message-----
I have defined a named range. I want to use VBA Code to

know whether a
particular address from sheet is a member of the defined

named range or
not ?

Thanks in advance.

Prasad Joshi


---
Message posted from http://www.ExcelForum.com/

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Cell is a Member of a range or Not

Your subject says cell implying a single cell, while your prose says address
which could mean multiple cells. If a single cell, intersect would work
fine. If multiple cells, intersect would not be definitive depending on
your definition of member - if member means a subset, the multiple cells and
and subset would be problematic for intersect. Union would be more
appropriate in this case.

if Union(Range(namedrange),Range(address)).address =
range(namedrange).address then

--
Regards,
Tom Ogilvy

"pgjoshi " wrote in message
...
I have defined a named range. I want to use VBA Code to know whether a
particular address from sheet is a member of the defined named range or
not ?

Thanks in advance.

Prasad Joshi


---
Message posted from http://www.ExcelForum.com/



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
Member database question! Lars Grøtteland Excel Worksheet Functions 0 September 6th 06 01:57 PM
condition - member of a group elbows Excel Discussion (Misc queries) 3 March 13th 06 04:57 PM
Is member of an array? Shatin Excel Programming 7 January 28th 04 06:17 PM
Is it possible to set a class member to be another class member? Michael[_21_] Excel Programming 3 October 30th 03 08:28 AM


All times are GMT +1. The time now is 12:12 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"