VBA excel 复制 转置黏贴 宏 Crypto 网页整理
1 Sub Macro2() 2 ' 3 ' Macro2 Macro 4 ' 宏由 pc 录制,时间: 2021/06/15 5 ' 6 7 ' 8 9 For j = 1 To 92 10 Range(Cells(j + 17 * (j - 1), 1), Cells(j + 17 * j, 1)).Select 11 Selection.Copy 12 Cells(j, 2).Select 13 Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlPasteSpecialOperationNone, SkipBlanks:=False, Transpose:=True 14 Next 15 End Sub
由于两种格式略有差
1 Sub Macro1() 2 ' 3 ' Macro1 Macro 4 ' 宏由 pc 录制,时间: 2021/06/15 5 ' 6 7 ' 8 Dim i As Integer 9 For i = 1 To 8 10 Range(Cells(i + 18 * (i - 1), 1), Cells(i + 18 * i, 1)).Select 11 Selection.Copy 12 Cells(i, 2).Select 13 Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlPasteSpecialOperationNone, SkipBlanks:=False, Transpose:=True 14 Next 15 End Sub
官方参考文档