Strange CopyRange behaviour
Hi
Range1 and Range2 are objects so
Set Range2 = Range1
would be OK syntax, creating an object variable called Range2 but not
overwriting Range2 values with Range1 values.
Range2.Value = Range1
would not be good syntax as the output of the Value Method is being
assigned to a range object. No overwrite will occur and there should
be a datatype error??
Range2 = Range1.Value
The default Method of the Range object is Value so this is the same as
option 4.
I know that the Value Method creates an array if the range is multi-
celled, but not if it is a single cell (there is no 1 by 1 array).
This must have a bearing on the issue I suppose and allow some kind of
overloading of the Range datatype in this special case but my
expertise ends there!
regards
Paul
On Sep 16, 12:39*pm, "Bruno Campanini" wrote:
Range1 and Range2 are multiple-cells ranges.
1 - Range2 = Range1
2 - Range2.Value = Range1
3 - Range2 = Range1.Value
4 - Range2.Value = Range1.Value
Lines 1 and 2 don't copy anything
Lines 3 and 4 copy Range1 over Range2
Instead, if Range1 and Range2 are single-cell ranges,
all lines 1 to 4 copy Range1 over Range2.
That's since Excel 2003 (at least!)
Any comments?
Bruno
|