Pastes a Range object that has been copied into the specified range.
Syntax
expression.PasteSpecial (Paste, Operation, SkipBlanks, Transpose)
expression A variable that represents a Range object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Paste | Optional | XlPasteType | The part of the range to be pasted, such as xlPasteAll or xlPasteValues. |
Operation | Optional | XlPasteSpecialOperation | The paste operation, such as xlPasteSpecialOperationAdd. |
SkipBlanks | Optional | Variant | True to have blank cells in the range on the clipboard not be pasted into the destination range. The default value is False. |
Transpose | Optional | Variant | True to transpose rows and columns when the range is pasted. The default value is False. |
Return value
Variant
Example
This example replaces the data in cells D1:D5 on Sheet1 with the sum of the existing contents and cells C1:C5 on Sheet1.
With Worksheets("Sheet1")
.Range("C1:C5").Copy
.Range("D1:D5").PasteSpecial Operation:=xlPasteSpecialOperationAdd
End With
More examples please read this article: Excel Macro: Copy and Paste a Range