level 10
假设C列数据连续,且都为自然数,代码如下:
Sub MyInsert()
Dim t&, irow&, i&, n&, r&
r = Cells(Rows.Count, 3).End(xlUp).Row
Do
n = n + 1
t = Val(Cells(irow + 1, 3))
If t > 1 Then
For i = 1 To t - 1
Cells(irow + 2, 3).EntireRow.Insert
Next
End If
irow = irow + t
Loop Until n = r
End Sub
2018年05月10日 11点05分
4