0
我发现下面在这里的代码:Insert row below based on cell value excel macro插入行xlUP不工作
它的工作原理,但是,像其他消息中的海报,我要插入现有行下面的新行(这里行一个“2”),而不是上面。我试过将Shift:=xlDown
更改为xlUp
,但这没有效果。我在想什么?
Sub BlankLine()
Dim Col As Variant
Dim BlankRows As Long
Dim LastRow As Long
Dim R As Long
Dim StartRow As Long
Col = "C"
StartRow = 1
BlankRows = 1
With ActiveSheet
For R = LastUsedRow() To StartRow + 1 Step -1
If .Cells(R, Col) = "2" Then
.Cells(R, Col).EntireRow.Insert Shift:=xlDown
End If
Next R
End With
End Sub