Copy and Cut Methods

As applied to the Range object, the Copy method has the syntax:


where Destination is a Range object that specifies the new range to which the specified range will be copied. If this argument is omitted, Excel will copy the range to the Clipboard. For instance, the code:

Range("A1:C3").Copy Range("D5")

copies the range A1:C3 to a range of like size whose upper-left corner is cell D5. Note that the same rules apply here as when copying using Excel's user interface. In particular, if the destination is more than a single cell, then it must have the same dimensions as the source range or else an error will occur.

The Cut method has similar syntax:

RangeObject.Cut(Destination) and cuts the range rather than copying it.

0 0

Post a comment