0

如果在指定列中上下行不同,您将如何插入一行。例如: 您希望在第 2 行下插入一行并将第 3 行向下移动。
A1 : Hello
A2 : Hello
A3 : Goodbye

谢谢!

4

1 回答 1

1
Sub insert()
    dim lastrow as long, i as long
    With ActiveSheet
        lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
    End With
    For i = lastrow To 2 Step -1
        If Not Cells(i, 1) = Cells(i - 1, 1) Then
            Rows(i).insert shift:=xlShiftDown
        End If
    Next i
End Sub
于 2013-08-22T22:02:20.427 回答