Range.PasteSpecial 方法 (Excel)Range.PasteSpecial method (Excel)

粘贴已复制到指定区域的range对象。Pastes a Range object that has been copied into the specified range.

语法Syntax

表达式PasteSpecial(PasteOperationSkipBlanks换位)expression.PasteSpecial (Paste, Operation, SkipBlanks, Transpose)

expression 一个表示 Range 对象的变量。expression A variable that represents a Range object.

参数Parameters

名称Name 必需/可选Required/Optional 数据类型Data type 说明Description
PastePaste 可选Optional XlPasteTypeXlPasteType 要粘贴的区域部分,例如 xlPasteAllxlPasteValuesThe part of the range to be pasted, such as xlPasteAll or xlPasteValues.
OperationOperation 可选Optional XlPasteSpecialOperationXlPasteSpecialOperation 粘贴操作,例如 xlPasteSpecialOperationAddThe paste operation, such as xlPasteSpecialOperationAdd.
SkipBlanksSkipBlanks 可选Optional VariantVariant 如果为 True,则不将剪贴板上区域中的空白单元格粘贴到目标区域中。True to have blank cells in the range on the clipboard not be pasted into the destination range. 默认值为 FalseThe default value is False.
TransposeTranspose 可选Optional VariantVariant 如果为 True , 则在粘贴区域时转置行和列。True to transpose rows and columns when the range is pasted. 默认值为 FalseThe default value is False.

返回值Return value

VariantVariant

示例Example

本示例用单元格 Sheet1 上单元格区域 C1:C5 和单元格区域 D1:D5 原有内容相加之和来替换单元格区域 D1:D5 中的数据。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

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.