Paste Special Method

This method pastes data from the Clipboard into the specified range. The syntax is:

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

The Paste parameter indicates what will be pasted and is one of the following XlPasteType constants:

Enum XlPasteType xlPasteValues = -4163 xlPasteComments = -4144 xlPasteFormulas = -4123 xlPasteFormats = -4122

xlPasteAll = -4104 ' Default xlPasteAllExceptBorders = 6 End Enum

The optional Operation parameter specifies a paste operation and can be one of the following

XlPasteSpecialOperation constants:

Enum XlPasteSpecialOperation xlPasteSpecialOperationNone = -4142 ' Default xlPasteSpecialOperationAdd = 2 xlPasteSpecialOperationSubtract = 3 xlPasteSpecialOperationMultiply = 4 xlPasteSpecialOperationDivide = 5 End Enum

The SkipBlanks parameter should be set to True to skip pasting blank cells from the Clipboard. To illustrate, suppose that the cell on the Clipboard that is destined to be pasted into cell D5 is blank. If SkipBlanks is False (the default), then whatever is in D5 before the paste operation will be overwritten when the blank cell is pasted, so D5 will then be empty. However, if SkipBlank is True, the blank cell will not be pasted into D5 and so the contents of D5 will not be disturbed.

The optional Transpose parameter can be set to True to transpose rows and columns when the range is pasted. The default value is False.

0 0

Post a comment