【发布时间】:2019-12-14 16:20:16
【问题描述】:
我在Insert copied row based on cell value 找到了一个宏。
该宏在 E 列中任何值为“0”的行上方插入一个空白行。
我需要它出现在下面,而不是出现在上面的空行。
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
【问题讨论】: