ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is Range Between two Ranges (https://www.excelbanter.com/excel-programming/304581-re-range-between-two-ranges.html)

Bernie Deitrick

Is Range Between two Ranges
 
Kevin,

In the event below,

Not Intersect(Target,Range(rgeStart,rgeEnd)) Is Nothing

will return TRUE if the Target is between rgeStart and rgeEnd.

HTH,
Bernie
MS Excel MVP

"Kevin McCartney" wrote in
message ...
I'd like to find if the selected cell is between two ranges, does anyone

know the required code.

Private Sub xlApp_SheetSelectionChange(ByVal Sh As Object, ByVal Target As

Range)
Dim rgeStart As Range, rgeEnd As Range

Set rgeStart = Sh.Range("B15")
Set rgeEnd = Sh.Cells.SpecialCells(xlCellTypeLastCell)

End Sub

TIA
KM





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

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