在Excel VBA的原始表中的每行之间添加10行

我有一个数据表,我想在原始表的每一行之间插入正好20行。 我已经尝试运行嵌套的for循环来添加每个循环的每一行,并跳到我的表上下一个“原始”行上添加另外20行以下。 但是,这是永久的,因为我的电子表格中有超过2000行。 有没有其他方法可以做到这一点? 任何VBA代码,我可以用这个?

尝试这个:

 Sub AddRows() ScreenUpdating = False With ActiveSheet lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row End With Dim AddRows As Integer: AddRows = 10 Dim i As Integer: i = lastrow Do While i <> 1 Rows(i & ":" & i + AddRows - 1).Insert i = i - 1 Loop ScreenUpdating = True End Sub 

一个解决scheme的基础(即改变循环的上下界,或者以编程方式添加它们)

 For i = 10 To 1 Step -1 Rows(i + 1 & ":" & i + 10).Insert Next