How to use CopyRange

CopyRange function

CopyRange takes a cell range and copies the contents of the range to another location. The new cell range will have the same dimensions as the source range. You specify the location of the destination by passing in the cell which is at the top left corner (position 1, 1 of the new range).

The syntax to use the function in user code is:

CopyRange(sourceRange, destinationCell, copyTraits=False, sortCol=None)

The sourceRange is the range of cells you want to copy,

The destinationCell is the home cell in the top left-hand corner of the range where you want to copy the data to. If the destination range would cause existing cell contents to be over-written, a ValueError is raised. There is no need for the destinationCell to be on the same worksheet as the original range.

If copyTraits is True, then traits are copied as well.

if sortCol is an integer between 1 and the number of columns in the range, the destination range will end up with the rows in the source range sorted, based on the values in the corresponding column in the source.

If you don't need to copy the traits of sort the rows, you can just call the function as follows:

CopyRange(sourceRange, destinationCell)

If you just want to copy the traits, you can call the function as follows:

CopyRange(sourceRange, destinationCell, True)

However, if you want to sort without copying traits, you either need to specify the sortCol argument by name:

CopyRange(sourceRange, destinationCell, sortCol=3)

Or include the default value of the copyTraits argument:

CopyRange(sourceRange, destinationCell, False, 3)


CopyRange returns the new cell range and can be assigned to a variable.

If the resulting cell range would overlap with original data in the destination range, and therefore partly overwrite it, a ValueError is raised.


Comments

If you have comments, questions or suggestions about any of the Resolver One documentation, please post them to the Documentation Suggestions Forum.

Retrieved from "http://www.resolversystems.com/documentation/index.php/How_to_use_CopyRange"

This page has been accessed 672 times. This page was last modified 15:30, 25 June 2008.

This page: Printable version | View source | Discuss this page | Page history | What links here | Related changes


This Wiki: Special pages | Disclaimers | Privacy policy | Recent changes | Log in / create account

Powered by MediaWiki