Excel: Copying and Pasting Regions Through a MacroLast reviewed: November 2, 1994Article ID: Q36888 |
SUMMARYWhen you are copying from one region to another, make sure that the only macro command between the COPY() and PASTE() command is SELECT(). Many commands can cancel the COPY() command and empty the Clipboard. If any of these commands are placed prior to the PASTE() [or PASTE.SPECIAL()] command, there will be nothing in the Clipboard to paste.
Example
=SET.NAME("CopyArea",SELECTION()) =SET.NAME("PasteArea",INPUT("Select the area to paste to",8)) =SELECT(CopyArea) =COPY() =SELECT(PasteArea) =PASTE() =CANCEL.COPY() =RETURN()This macro assumes that the area to be copied is the current selection. It then asks you to select the area to paste into. It does no error checking to be sure that these regions are of comparable size. It creates names for these regions, then selects the region to be copied, copies this region, selects the region to paste into, and pastes.
|
KBCategory: kbother
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |