Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Member database question! | Excel Worksheet Functions | |||
condition - member of a group | Excel Discussion (Misc queries) | |||
Is member of an array? | Excel Programming | |||
Is it possible to set a class member to be another class member? | Excel Programming |