これには 1 秒未満かかりました。
Sub InsertRows()
Dim numberOfValues As Long
Dim i As Long
Dim values As Variant
Const numberOfEmptyRows As Long = 11
Application.ScreenUpdating = False
' count values in column A
numberOfValues = Cells(Rows.Count, "A").End(xlUp).Row
' populate array with numbers
ReDim values(1 To numberOfValues, 1 To 1)
For i = 1 To numberOfValues
values(i, 1) = i
Next i
' I know there is a better way to do this part...
Range(Cells(1, 2), Cells(numberOfValues, 2)).Value = values
For i = 1 To numberOfEmptyRows - 1
Range(Cells(Rows.Count, "B").End(xlUp).Offset(1, 0), Cells(Rows.Count, "B").End(xlUp).Offset(numberOfValues, 0)).Value = values
Next i
' sort by values inserted in column B
Range(Cells(1, 1), Cells(Rows.Count, "B").End(xlUp)).Sort Key1:=Range("B1"), _
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Columns("B:B").EntireColumn.Delete
Application.ScreenUpdating = True
End Sub
このコードは、ヘルパー列 (この場合は B) を使用して、ターゲット範囲の隣に番号シーケンスを挿入します。次に、同じ数字をそれ自体の下に N 回追加し、その列で並べ替えます。最後に、列を削除します。これにより、任意のデータ セットに空白行をすばやく挿入できます。
空白行の挿入量を増減するかどうかを変更Const numberOfEmptyRows As Long = 11
します。Excel の行制限に達する前に、この手法で処理できるレコードの数 (および挿入できる空白行の数) には制限があります。