statement explanation

  • Thread starter Thread starter dreamer
  • Start date Start date
D

dreamer

Can somebody tell me what this three statements do?

1. "If Not Intersect(.Cells, Range("A:C")) Is Nothing Then"


2. "With Cells(.Row, 1).Resize(1, 3)"

3. "... = .item(3) " (this one is in compination with the wit
statement
 
dreamer > said:
Can somebody tell me what this three statements do?

1. "If Not Intersect(.Cells, Range("A:C")) Is Nothing Then"

This checks whether the two specified ranges intersect or not. The intersect
method returns a range object, so if any part of the two ranges do
intersect, the range onbject will not be nothing.

In this instance, it is meaningless, because it checks for an intersect
between Cells, the whole worksheet, with columns A:C, part of the worksheet,
which must intersecet.

2. "With Cells(.Row, 1).Resize(1, 3)"

Whatever cell is referred to by Cells(Row,1) is resized by 1 row and 3
columns and then used in the ensuing statements.

3. "... = .item(3) " (this one is in compination with the with
statement)

This is picking up the 3rd item in a collection , the collection being
whatever the With statement refers to.
 
1. "If Not Intersect(.Cells, Range("A:C")) Is Nothing Then"
In this instance, it is meaningless, because it checks for an intersect
between Cells, the whole worksheet, with columns A:C, part of the worksheet,
which must intersecet.

Not necessarily. It (.cells) is qualifying something in an unshown With
statement, so if the with statement is a range, it may be a valid check.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top