ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   What range is a cell in? (https://www.excelbanter.com/excel-programming/297716-what-range-cell.html)

ppsza[_6_]

What range is a cell in?
 
Concerning Excel VBA: Does anyone know of a way that I can find ou
what range a particular cell (ActiveCell) is in? Here's th
situation: I have several named ranges in a worksheet. When a cel
changes, if it is in a particular range, then some code needs to b
executed, and, if it's in another range, other code needs to b
executed

Thanks


Steve Garman

What range is a cell in?
 
Ye, Bob Phillips does

http://www.google.com/groups?selm=Ov...GP11.phx.gb l

ppsza wrote:

Concerning Excel VBA: Does anyone know of a way that I can find out
what range a particular cell (ActiveCell) is in? Here's the
situation: I have several named ranges in a worksheet. When a cell
changes, if it is in a particular range, then some code needs to be
executed, and, if it's in another range, other code needs to be
executed.

Thanks!



Dennis

What range is a cell in?
 
I looked at the link:

If Intersect(Activecell,Range("Name1") Then
'do something
ElseIf Intersect(Activecell,Range("Name2") Then
'do something else
etc.

Is it possible to replace the 'Range("Name1")' Range
("a1:10")' or suchlike?


-----Original Message-----
Ye, Bob Phillips does

http://www.google.com/groups?selm=OvDsp5TMEHA.2284%

40TK2MSFTNGP11.phx.gbl

ppsza wrote:

Concerning Excel VBA: Does anyone know of a way that I

can find out
what range a particular cell (ActiveCell) is in? Here's

the
situation: I have several named ranges in a worksheet.

When a cell
changes, if it is in a particular range, then some code

needs to be
executed, and, if it's in another range, other code

needs to be
executed.

Thanks!


.


Bob Phillips[_6_]

What range is a cell in?
 
Dennis,

Indeed it is. The previous poster ws using named ranges, that is why we used
that syntax. The other post is not absolutely correct, this is (I hope)

If Not Intersect(ActiveCell, Range("A1:A10")) Is Nothing Then
'do something
ElseIf Not Intersect(ActiveCell, Range("B1:B10")) Is Nothing Then
'do something else
etc.

It works in the same way

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Dennis" wrote in message
...
I looked at the link:

If Intersect(Activecell,Range("Name1") Then
'do something
ElseIf Intersect(Activecell,Range("Name2") Then
'do something else
etc.

Is it possible to replace the 'Range("Name1")' Range
("a1:10")' or suchlike?


-----Original Message-----
Ye, Bob Phillips does

http://www.google.com/groups?selm=OvDsp5TMEHA.2284%

40TK2MSFTNGP11.phx.gbl

ppsza wrote:

Concerning Excel VBA: Does anyone know of a way that I

can find out
what range a particular cell (ActiveCell) is in? Here's

the
situation: I have several named ranges in a worksheet.

When a cell
changes, if it is in a particular range, then some code

needs to be
executed, and, if it's in another range, other code

needs to be
executed.

Thanks!


.




Bob Phillips[_6_]

What range is a cell in?
 
It actually has an error, it should be

If Not Intersect(ActiveCell, Range("Name1")) Is Nothing Then
'do something
ElseIf Not Intersect(ActiveCell, Range("Name2")) Is Nothing Then
'do something else
etc.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Steve Garman" wrote in message
...
Ye, Bob Phillips does

http://www.google.com/groups?selm=Ov...GP11.phx.gb l

ppsza wrote:

Concerning Excel VBA: Does anyone know of a way that I can find out
what range a particular cell (ActiveCell) is in? Here's the
situation: I have several named ranges in a worksheet. When a cell
changes, if it is in a particular range, then some code needs to be
executed, and, if it's in another range, other code needs to be
executed.

Thanks!






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

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