![]() |
#2
|
|||
|
|||
![]()
Found this on Stack overflow. Not sure why it won't display the code any better ?
Determine if a cell is within a range using VBA in Microsoft Excel: From the linked site (maintaining credit to original submitter): VBA macro tip contributed by Erlandsen Data Consulting offering Microsoft Excel Application development, template customization, support and training solutions Code:
Function InRange(Range1 As Range, Range2 As Range) As Boolean ' returns True if Range1 is within Range2 InRange = Not (Application.Intersect(Range1, Range2) Is Nothing)End FunctionSub TestInRange() If InRange(ActiveCell, Range("A1:D100")) Then ' code to handle that the active cell is within the right range MsgBox "Active Cell In Range!" Else ' code to handle that the active cell is not within the right range MsgBox "Active Cell NOT In Range!" End If End Sub Last edited by trevorc; 06-19-2018 at 01:16 AM. Reason: won't display the code very well. |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
EXCEL 2016 - merging multiple selected cells | kevin.suh | Excel | 2 | 03-28-2017 07:01 AM |
![]() |
FaizanRoshan | Word VBA | 7 | 10-18-2015 03:34 PM |
![]() |
DonJohns1 | Excel Programming | 2 | 04-15-2015 10:48 AM |
![]() |
AdieReeves | Word Tables | 7 | 10-22-2014 07:59 AM |
How to keep orientation when printing Selected Cells | punkrae | Excel | 1 | 04-09-2012 05:32 PM |