根据单元格值插入复制的行

下面的vba代码(从这里修改)将在E列中具有值“0”的任何行上面插入一个空白行。而不是插入一个空白行,有没有办法用“0”复制行并插入它在上面呢? 可以修改这个VBA代码来做到这一点?

Sub BlankLine() Dim Col As Variant Dim BlankRows As Long Dim LastRow As Long Dim R As Long Dim StartRow As Long Col = "E" StartRow = 1 BlankRows = 1 LastRow = Cells(Rows.Count, Col).End(xlUp).Row Application.ScreenUpdating = False With ActiveSheet For R = LastRow To StartRow + 1 Step -1 If .Cells(R, Col) = "0" Then .Cells(R, Col).EntireRow.Insert Shift:=xlDown End If Next R End With Application.ScreenUpdating = True End Sub 

只需添加这一行

 .Cells(R, Col).EntireRow.Copy 

在你的.Insert行之前