ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to verify a cell is in a named range (https://www.excelbanter.com/excel-programming/303997-how-verify-cell-named-range.html)

Terry Lowe[_2_]

How to verify a cell is in a named range
 
I give up. I have been trying to figure this out but I can only get half of
it. I think I need "professional help"!

I have a range name "TimeCells". I need to write an IF statement to verify
that the activecell is within the bounds of the named range. Also I need to
verify that I am on the correct worksheet.

Any help would be greatly appreciated.



JE McGimpsey

How to verify a cell is in a named range
 
One way:


Dim bSameSheet As Boolean
Dim bInRange As Boolean

With Range("TimeCells")
bSameSheet = .Parent Is ActiveSheet
If bSameSheet Then bInRange = _
Not Intersect(.Cells, ActiveCell) Is Nothing
End With

In article ,
"Terry Lowe" wrote:

I give up. I have been trying to figure this out but I can only get half of
it. I think I need "professional help"!

I have a range name "TimeCells". I need to write an IF statement to verify
that the activecell is within the bounds of the named range. Also I need to
verify that I am on the correct worksheet.

Any help would be greatly appreciated.



All times are GMT +1. The time now is 12:27 PM.

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