Explanation Code

alone

New Member
Joined
Mar 9, 2011
Messages
17
Hello
Could anyOne explain this part of the code
if not intersect (target,range("c1") is nothing then

and the same code

If Not FoundCell Is Nothing

I have tried several times to their understanding, but I failed
I hope that I find it explains me in detail, especially as I am newbie in programming
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hi.

Code:
If Not Intersect(Target, Range("A1:A5")) Is Nothing Then

Target is in the range A1:A5.

Code:
Set FoundCell = Cells.Find(what:="A word")
If Not FoundCell Is Nothing Then

The search term was found.
 
Upvote 0
I'm sorry, Peter
I want to understand, word for word
So I can write sentences serve My Codes
 
Upvote 0
Take the second example. If the search term isn't found, FoundCell is set to the value Nothing. to check that the value is not Nothing we need to use the Not operator.
 
Upvote 0
From the Help on the Intersect method
Returns a Range object that represents the rectangular intersection of two or more ranges.

In the example, if Target is not in the range A1:A5 the result of Intersect is Nothing. To check if Target is in the range A1:A5 we need to test for Not Intersect(...) Is Nothing.
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,894
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top