Difference between range and array

P

Paul Smith

Dear All

Could someone please explain to me what is the difference between
"range" and "array"?

Thanks in advance,

Paul
 
B

Bob Phillips

A range is a set of contiguous cells within a spreadsheet, that is a number
of cells within a column or a row, or an a group of n rows and m columns. A
range is rectangular in shape.

An array is a series of objects, such as an array of integers, an array of
strings, or even an array of range objects <G>.

In a worksheet, an array formula works upon a range of cells, and so is
implicitly linked to that range. In VBA, an array can be loaded with a
range, but it then is loaded with the range values, and loses any
relationship to that range.

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)
 
P

Paul Smith

A range is a set of contiguous cells within a spreadsheet, that is a number
of cells within a column or a row, or an a group of n rows and m columns. A
range is rectangular in shape.

An array is a series of objects, such as an array of integers, an array of
strings, or even an array of range objects <G>.

In a worksheet, an array formula works upon a range of cells, and so is
implicitly linked to that range. In VBA, an array can be loaded with a
range, but it then is loaded with the range values, and loses any
relationship to that range.

Thanks, Bob, for your clear explanation.

Paul
 
T

tony h

Just being pedantic. I would have described a "range" as "usually being
rectangular" but can be "any collection of cells". In code I like to
differentiate between these by using a prefix of rng for a rectangular
collection of cells and rngd for a discontiguous collection. It can be
particularly important to identify the difference when using the
selection object.

regards
 
B

Bob Phillips

If it is dis-contiguous, it is a number of areas.

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)
 
T

tony h

You are correct but it does not stop it being a range. A collection of
areas is a range. An Area is simply a special case range ie a
"discrete, contiguous range of cells". So you can say that a range is
rectangular if the number of areas within the range is 1. that is :
rng.areas().count=1.

regards
 
Top