添加行的VBA小程序

Sub addrows1()
   
    Dim i As Integer
    i = 1
    Sheets("yzm").Select
   
    For i = 3 To 8000
        Rows(i).Select
        If ((Cells(i, 1).Value) <> (Cells(i - 1, 1).Value)) Then
           
            'MsgBox (Cells(i, 1).Value + "  " + Cells(i - 1, 1).Value + " <> ")
            Rows(i).Insert
            i = i + 1
        Else
            'MsgBox ("=")
           
        End If
    Next
   
End Sub

 

posted on 2009-05-12 22:10  冰原雪龙  阅读(446)  评论(0编辑  收藏  举报