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/297094-what-range-cell.html)

ppsza[_4_]

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

Thanks

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


Bob Phillips[_6_]

What range is a cell in?
 

If Intersect(Activecell,Range("Name1") Then
'do something
ElseIf Intersect(Activecell,Range("Name2") 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)

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


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





All times are GMT +1. The time now is 06:58 PM.

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