简体   繁体   English

Excel宏行增量

[英]Excel Macro Row increment

I am trying to copy a range of cells in a single column and transpose them above as a row. 我试图在单列中复制一定范围的单元格,并将它们作为行移到上方。 The problem I am having is to try to increase the Rows(45:45) where each row is being copied, otherwise all of the rows get overwritten. 我遇到的问题是尝试增加要复制每行的Rows(45:45),否则所有行都会被覆盖。 When I run the macro I get a syntax error on Destination:= Range line 当我运行宏时,我在Destination:= Range行上遇到语法错误

Range("A53:A63").Copy
Range("A52").Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:=False _
    , Transpose:=True
Range("A53:A63").Select
Application.CutCopyMode = False
Selection.EntireRow.Delete
Rows("52:52").Cut
Rows("45:45").Select
Destination:=Range("A" & Rows.Count).End(xlDown).Offset(1, 0)
Selection.Insert

Although I do not really understand what you are trying to do but maybe this helps. 尽管我不太了解您要做什么,但这也许会有所帮助。

Sub test()
Range("A53:A63").Copy
Range("A52").Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:=False _
    , Transpose:=True
Range("A53:A63").Select
Application.CutCopyMode = False
Selection.ClearContents
Rows("52:52").Copy
    Range("A1").End(xlDown).Offset(1, 0).Select
    Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
End Sub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM