Exactly -- Spot-on recrit !!
for this decision, I would consider the following:
(1) Data type, search Excel Visual Basic Help for data type summary.
Using "set range" you create an object reference which only uses 4
bytes of memory. The size of the variable using a non-reference type
depends on what you are reading in from the cell.... worst case is
that its not consistent so you have to use variant type all the time
which uses 16 bytes or more depending if its a number or string.
However if you know you read in a boolean it only uses 2bytes and then
would be more memory efficient. Range object become versatile when
you are grinding data where the type is not all the same, so loop
through rows and doing something with value will be more efficient.
(2) if you are reading in a range of cells, Range("A1:A5")... you
still have the same choice. When pulled to a variable you end up with
an variant array which can amplify the memory issue. With the range
variable you get a referenced object again that you can still iterate
over, either for...each || for r=1 to rng.Rows.Count etc
(3) Range object allows access to all the Range properties, so it can
be useful for interacting with the sheet. ie changing colors, formats,
retrieving sheet object, dependents, etc
(4) If you are going to perform a destructive operation on the range
that you are reading in, then the reference variable will change
according... this can cause some errors and confusion. For instance
you are reading in Range("A1:A5") but then you delete rows 2 & 3 ...
your range variable will not have the values for rows 2 & 3 any
more.... in this case if you wanted those values you would have to
start with pulling the values into an array.
As you can see, it really depends on your application. My preference
is to use the range object if possible since its the most versatile
and memory efficient.
Hope this helps.