ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do i check if the current cell is part of a range ? (https://www.excelbanter.com/excel-programming/360077-how-do-i-check-if-current-cell-part-range.html)

Luc

How do i check if the current cell is part of a range ?
 
Lets say a that i have named some cells TABLE

How do i check if the current cell is in the range with the name TABLE?


Thanxxxx

Luc



Chip Pearson

How do i check if the current cell is part of a range ?
 
Luc,

Try some code like the following:

If Not Application.Intersect(ActiveCell, Range("Table")) Is
Nothing Then
Debug.Print "In Table"
Else
Debug.Print "Not in table"
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Luc" wrote in message
t...
Lets say a that i have named some cells TABLE

How do i check if the current cell is in the range with the
name TABLE?


Thanxxxx

Luc




JE McGimpsey

How do i check if the current cell is part of a range ?
 
One way:

If Not Intersect(ActiveCell, Range("TABLE")) Is Nothing Then
MsgBox "In TABLE"
Else
MsgBox "Not in TABLE"
End If


In article ,
"Luc" wrote:

Lets say a that i have named some cells TABLE

How do i check if the current cell is in the range with the name TABLE?


Thanxxxx

Luc



All times are GMT +1. The time now is 01:57 AM.

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