将“粘贴”数据范围值复制到下一个空行

我有一个电子表格,每天都用来生成当天的损益。 我在前一天的损益底部复制和粘贴13行。 我想要创build一个macros,将13个行复制到下一个空单元格。 我有代码抓住数据范围内的第一行和最后一行。

我不知道如何抓住13行,15行到27行,并把它们放到第二行空行29行:

在这里输入图像说明

到目前为止,我有这个代码:

Sub PasteValToNextRows() Application.ScreenUpdating = False lMaxRows = Cells(Rows.Count, "A").End(xlUp).row '*****Copy the Rows of Data Range and Paste to next second Empty Row***** ''''''Finds the First Row within a Data Range Range("A" & lMaxRows + 0).Offset(-12, 0).EntireRow.Select '''''Finds the Last Row within a Data Range Range("A" & lMaxRows + 0).EntireRow.Select Application.CutCopyMode = False Application.ScreenUpdating = True [![enter image description here][1]][1]End Sub 

使用复制/粘贴,因为它看起来像你有格式。 请参阅评论以反映您需要的范围。

 Sub cemg() Dim fRow As Long Dim lRow As Long With ActiveSheet lRow = .Cells(.Rows.Count, "A").End(xlUp).Row fRow = lRow - 12 .Range(.Cells(fRow, 1), .Cells(lRow, 6)).Copy 'change 6 to the number of columns you have .Cells(lRow + 2, 1).PasteSpecial End With End Sub