Difference between range and array

  • Thread starter Thread starter Paul Smith
  • Start date Start date
P

Paul Smith

Dear All

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

Thanks in advance,

Paul
 
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)
 
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
 
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
 
If it is dis-contiguous, it is a number of areas.

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)
 
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
 

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