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