Paste Method

Microsoft Excel Visual Basic

Show All

Paste Method

       

Paste method as it applies to the Chart object.

Pastes chart data from the Clipboard into the specified chart.

expression.Paste(Type)

expression   Required. An expression that returns a Chart object

Type  Optional Variant. Specifies the chart information to paste if a chart is on the Clipboard. Can be one of the following XlPasteType constants: xlFormats, xlFormulas, or xlAll. The default value is xlAll. If there’s data other than a chart on the Clipboard, this argument cannot be used.

Remark

This method changes the current selection.

Paste method as it applies to the Floor, Point, Series, and Walls objects.

For Floor and Walls objects, paste a picture from the Clipboard on the floor or walls of the specified chart. For Point and Series objects, pastes a picture from the Clipboard as the marker on the selected point or series. This method can be used on column, bar, line, or radar charts, and it sets the MarkerStyle property to xlMarkerStylePicture.

expression.Paste

expression   Required. An expression that returns one of the above objects.

Paste method as it applies to the SeriesCollection object.

Pastes data from the Clipboard into the specified series collection.

expression.Paste(Rowcol, SeriesLabels, CategoryLabels, Replace, NewSeries)

expression   Required. An expression that returns a SeriesCollection object.

Rowcol  Optional XlRowCol. Specifies whether the values corresponding to a particular data series are in rows or columns.

XlRowCol can be one of these XlRowCol constants.
xlColumns default
xlRows

SeriesLabels  Optional Variant. True to use the contents of the cell in the first column of each row (or the first row of each column) as the name of the data series in that row (or column). False to use the contents of the cell in the first column of each row (or the first row of each column) as the first data point in the data series. The default value is False.

CategoryLabels  Optional Variant. True to use the contents of the first row (or column) of the selection as the categories for the chart. False to use the contents of the first row (or column) as the first data series in the chart. The default value is False.

Replace  Optional Variant. True to apply categories while replacing existing categories with information from the copied range. False to insert new categories without replacing any old ones. The default value is True.

NewSeries  Optional Variant. True to paste the data as a new series. False to paste the data as new points in an existing series. The default value is True.

Paste method as it applies to the Worksheet object.

Pastes the contents of the Clipboard onto the sheet.

expression.Paste(Destination, Link)

expression   Required. An expression that returns a Worksheet object.

Destination  Optional Variant. A Range object that specifies where the Clipboard contents should be pasted. If this argument is omitted, the current selection is used. This argument can be specified only if the contents of the Clipboard can be pasted into a range. If this argument is specified, the Link argument cannot be used.

Link  Optional Variant. True to establish a link to the source of the pasted data. If this argument is specified, the Destination argument cannot be used. The default value is False.

Remarks

If you don’t specify the Destination argument, you must select the destination range before you use this method.

This method may modify the sheet selection, depending on the contents of the Clipboard.

Example

As it applies to the Chart object.

This example pastes data from the range B1:B5 on Sheet1 into Chart1.

Worksheets("Sheet1").Range("B1:B5").Copy
Charts("Chart1").Paste

As it applies to the Point or Series objects.

This example pastes a picture from the Clipboard into series one in Chart1.

Charts("Chart1").SeriesCollection(1).Paste

As it applies to the SeriesCollection object.

This example pastes a picture from the Clipboard into series one in Chart1.

Worksheets("Sheet1").Range("C1:C5").Copy
Charts("Chart1").SeriesCollection.Paste

As it applies to the Worksheet object.

This example copies data from cells C1:C5 on Sheet1 to cells D1:D5 on Sheet1.

Worksheets("Sheet1").Range("C1:C5").Copy
ActiveSheet.Paste Destination:=Worksheets("Sheet1").Range("D1:D5")