Skip to main content

PasteSpecial

Pastes the Range object to the specified range using the special paste options.

Syntax

expression.PasteSpecial(sPasteType, sPasteSpecialOperation, bSkipBlanks, bTranspose);

expression - A variable that represents a ApiRange class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sPasteTypeOptionalPasteType"xlPasteAll"Paste option.
sPasteSpecialOperationOptionalPasteSpecialOperation"xlPasteSpecialOperationNone"The mathematical operation which will be applied to the copied data.
bSkipBlanksOptionalbooleanfalseSpecifies whether to avoid replacing values in the paste area when blank cells occur in the copy area.
bTransposeOptionalbooleanfalseSpecifies whether the pasted data will be transposed from rows to columns.

Returns

This method doesn't return any data.

Example

Paste data from theclipboard (if it is possible) with the specified options in a spreadsheet.

// How to paste the copied or cut data from the clipboard using the special paste options in a spreadsheet.

// Create a range, copy its value and paste it into another one with the specified properties in a spreadsheet.

let worksheet = Api.GetActiveSheet();
let range = worksheet.GetRange("A1");
range.SetValue("test");
worksheet.GetRange("A1").Copy();
worksheet.GetRange("B1").PasteSpecial("xlPasteAll", "xlPasteSpecialOperationNone", false, false);