我正在尝试复制范围CW263:DC263并通过vba粘贴范围CX269:CX294,但我收到错误。
我正在使用这样的代码(它可能在所有工作表中重复相同):
Sub copiar_colar_reorganizado()
Dim oneRange As Range
Dim aCell As Range
Dim WS_Count As Integer
Dim I As Integer
' Set WS_Count equal to the number of worksheets in the active
' workbook.
WS_Count = ActiveWorkbook.Worksheets.Count
' Begin the loop.
For I = 1 To WS_Count
Set oneRange = Worksheets(I).Range("CZ269:DA294")
Set aCell = Worksheets(I).Range("DA269")
Worksheets(I).Range("CW263:DV263").Copy Worksheets(I).Range("CX269:CX294").PasteSpecial(Transpose:=True)
Next I
End Sub
但我得到的结论是:无法从Range类获取PasteSpecial属性。怎么弄这个?
答案 0 :(得分:1)
复制粘贴两行并删除转置周围的()
:
Worksheets(I).Range("CW263:DV263").Copy
Worksheets(I).Range("CX269:CX294").PasteSpecial Transpose:=True
一行仅用于完整拷贝而不是PasteSpecial。