• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 289
  • Last Modified:

Range question

Can you tell me what the code
If (Not Intersect(Target, Range("AD2:AD35000")) Is Nothing) _
    Or (Not Intersect(Target, Range("AH2:AH35000")) Is Nothing) Then.....

means please
0
GordonMasson
Asked:
GordonMasson
  • 4
  • 2
1 Solution
 
zorvek (Kevin Jones)ConsultantCommented:
The code is checking if the Target range is in either of the specified ranges.

Kevin
0
 
zorvek (Kevin Jones)ConsultantCommented:
Intersect(Target, Range("AD2:AD35000")) returns a range object representing the overlap between Target and AD2:AD35000. If there is no overlap it returns Nothing.

Kevin
0
 
GordonMassonAuthor Commented:
and by Target that means the text/value in the cell that has been selected?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
zorvek (Kevin Jones)ConsultantCommented:
That depends on where the code is. If in the SelectionChange event handler then yes.

Kevin
0
 
GordonMassonAuthor Commented:
Thanks
0
 
zorvek (Kevin Jones)ConsultantCommented:
And Target is a Range object, not a cell value. If you select a cell then Target is a Range object that refers to the selected cell or cells. Target.Value returns the value or values contained in the selected cell(s). Of course, most of the time an object has a default property and, in the case of the Range object, it is Value.

Kevin
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now