ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Active cell is within a specific range (https://www.excelbanter.com/excel-programming/315423-active-cell-within-specific-range.html)

Todd huttenstine

Active cell is within a specific range
 
I need to check to see if the activecell is within a
particular range. Lets say I want to see if the active
cell is within range "A1:F20". How do I do this?


Thanks
Todd Huttenstine

Chip Pearson

Active cell is within a specific range
 
Todd,

Use the Intersect method. For example,

If Application.Intersect(ActiveCell,Range("A1:F20") Is Nothing
Then
' active cell not in range
Else
' active cell in range
End If


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



"Todd Huttenstine" wrote in
message ...
I need to check to see if the activecell is within a
particular range. Lets say I want to see if the active
cell is within range "A1:F20". How do I do this?


Thanks
Todd Huttenstine





All times are GMT +1. The time now is 04:21 AM.

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