PasteSpecial Method (Range Object)

Applies To

Range object.

Description

Pastes a Range from the Clipboard into the specified range.

Syntax

expression.PasteSpecial(Paste, Operation, SkipBlanks, Transpose)

expression Required. An expression that returns a Range object.

Paste Optional Variant. The part of the range to be pasted. Can be one of the following XlPasteType constants: xlPasteAll, xlPasteFormulas, xlPasteValues, xlPasteFormats, xlPasteNotes, or xlPasteAllExceptBorders. The default value is xlPasteAll.

Operation Optional Variant. The paste operation. Can be one of the following XlPasteSpecialOperation constants: xlPasteSpecialOperationNone, xlPasteSpecialOperationAdd, xlPasteSpecialOperationSubtract, xlPasteSpecialOperationMultiply, or xlPasteSpecialOperationDivide. The default value is xlPasteSpecialOperationNone.

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.

See Also

Copy method, Cut method, Paste method, PasteSpecial method (Worksheet object).

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