Copy Method

Applies To

Arc Object, Arcs Collection, Button Object, Buttons Collection, Chart Object, ChartArea Object, ChartObject Object, ChartObjects Collection, Charts Collection, CheckBox Object, DialogSheet Object, DialogSheets Collection, Drawing Object, DrawingObjects Collection, Drawings Collection, DropDown Object, DropDowns Collection, EditBox Object, EditBoxes Collection, GroupBox Object, GroupBoxes Collection, GroupObject Object, GroupObjects Collection, Label Object, Labels Collection, Line Object, Lines Collection, ListBox Object, ListBoxes Collection, Module Object, Modules Collection, OLEObject Object, OLEObjects Collection, OptionButton Object, OptionButtons Collection, Oval Object, Ovals Collection, Picture Object, Pictures Collection, Point Object, Range Object, Rectangle Object, Rectangles Collection, ScrollBar Object, ScrollBars Collection, Series Object, Sheets Collection, Spinner Object, Spinners Collection, TextBox Object, TextBoxes Collection, ToolbarButton Object, Worksheet Object, Worksheets Collection.

Description

Syntax 1: Copies the control or drawing object to the Clipboard. Copies a picture of the point or series to the Clipboard.

Syntax 2: Copies the Range to the specified range or to the Clipboard.

Syntax 3: Copies the sheet to another location in the workbook.

Syntax 4: Copies a toolbar button to another position, either on the same toolbar or to another toolbar.

Syntax 1

object.Copy

Syntax 2

object.Copy(destination)

Syntax 3

object.Copy(before, after)

Syntax 4

object.Copy(toolbar, before)

object

Required. The object to which this method applies. Copying a Chart object uses Syntax 3, and copies the entire chart sheet. To copy only the chart area, use Syntax 1 with the ChartArea object.

destination

Optional. Specifies the new range where the specified range will be copied. If this argument is omitted, Microsoft Excel copies the range to the clipboard.

before

Syntax 3: Optional. The sheet before which this sheet will be copied. You cannot specify before if you specify after.

Syntax 4: Required. Specifies the new button position as a number from one to the number of existing buttons + one. Gaps count as one position. Buttons to the right of this position are moved right (or down) to make room for the copied button.

after

Optional. The sheet after which this sheet will be copied. You cannot specify after if you specify before.

toolbar

Required for Syntax 4. Specifies the toolbar object to copy the button to.

Remarks

If you do not specify either before or after, Microsoft Excel creates a new workbook containing the copied sheet.

To copy a button and insert a gap before the copied button, first insert a gap on the destination toolbar using the ToolbarButtons Add method, then copy the button to the position after the new gap.

See Also

Move Method, Paste Method.

Example

This example copies button one on Sheet1 to the Clipboard.


Worksheets("Sheet1").Buttons(1).Copy

This example copies Sheet1, placing the copy after Sheet3.


Worksheets("Sheet1").Copy after := Worksheets("Sheet3")

This example copies the used range of Sheet1, creates a new worksheet, and then pastes the values of the copied range into the new worksheet.


Worksheets("Sheet1").UsedRange.Copy
Set newSheet = Worksheets.Add
newSheet.Range("A1").PasteSpecial Paste:=xlValues

This example copies the formulas in cells A1:D4 on Sheet1 to cells E5:H8 on Sheet2.


Worksheets("Sheet1").Range("A1:D4").Copy _
    destination:=Worksheets("Sheet2").Range("E5")