Export (0) Print
Expand All
0 out of 8 rated this helpful - Rate this topic

Paste Method

 

Pastes the contents of the Clipboard onto the sheet. If you don’t specify the Destination argument, you must select the destination range before you use this method.

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.

Link  Optional Variant.  Not supported in this version of the Spreadsheet component.

Pastes the Clipboard contents into the specified range.

expression.Paste

expression   An expression that returns a Range object.

Example

This example copies cells A1:D10 on Sheet1 and pastes starting at cell A1 in Sheet2.

Sub PasteData()

    ' Copy cell A1:D10 in Sheet1.
    Spreadsheet1.Sheets("Sheet1").Range("A1:D10").Copy

    ' Paste starting at cell A1 of Sheet2.
    Spreadsheet1.ActiveSheet.Paste
    Spreadsheet1.Sheets("Sheet2").Range("A1")

End Sub

This example pastes the contents of cell A1 into cells A3, A5, and A7.

Sub PasteRange()

    Dim iRowNum

    ' Copy cell A1 on the active worksheet.
    Spreadsheet1.ActiveSheet.Range("A1").Copy

    ' Loop through the odd numbers from 3 to 7.
    For iRowNum = 3 To 7 Step 2
        ' Paste the copied cell.
        Spreadsheet1.ActiveSheet.Cells(iRowNum, 1).Paste
    Next

End Sub

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.