【发布时间】:2015-12-06 09:37:51
【问题描述】:
我正在使用以下宏来复制范围并将其粘贴到下一个可用行。
Dim NextRow As Range
Sub Save8()
Dim sht As Worksheet, currentRow As Range
Application.ScreenUpdating = False
Set sht = Sheets("Time Allocation")
Set currentRow = sht.Range(sht.UsedRange.Address)
Set NextRow = currentRow.Offset(currentRow.Rows.Count, 0)
Sheets("Time Allocation").Range("B506:L515").Copy
'NextRow.PasteSpecial Paste:=1, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
NextRow.PasteSpecial xlPasteAll
Application.CutCopyMode = False
Set NextRow = Nothing
Set currentRow = Nothing
Set sht = Nothing
Application.ScreenUpdating = True
End Sub
代码工作正常,但是说我要复制的范围如下所示:
Example 1 Test
Test Test
Test Test
Test Test
然后,我的代码会将复制的范围粘贴到原始范围下方,如下所示:
Example 1 Test
Test Test
Test Test
Test Test
Example 1 Test
Test Test
Test Test
Test Test
但现在我想增加 b 列“示例 1”中左上角单元格中的值
所以每次复制和粘贴范围时,我都会得到类似的结果:
Example 1 Test
Test Test
Test Test
Test Test
Example 2 Test
Test Test
Test Test
Test Test
Example 3 Test
Test Test
Test Test
Test Test
请有人告诉我如何做到这一点?提前致谢
【问题讨论】:
-
第2行还是第1行的第一个示例1?