楼上的程序有点问题,会漏掉后面的处理,应该从下往上去处理!!!
鼠标右击Sheet1标签,先【查看代码】,在代码窗口粘贴下面的代码:
Sub ouyangff()
For i = [a65536].End(3).Row To 1 Step -1
If Right(Cells(i, 1), 2) = "小计" Then Rows(i + 1).Insert Shift:=xlDown
Next
End Sub
按F5 运行程序,按Alt + F11回到Excel去看看结果!!!
Sub 插入空行()
Dim i As Integer
For i = [a65536].End(3).Row To 1 Step -1
If Right(Cells(i, 1), 2) = "小计" Then Rows(i + 1).Insert Shift:=xlDown
Next
End Sub
daDasdasdA