Sub insertRow()
' insertRow Macro
' 宏由 mike 錄製,時間: 2012-8-6
' 快捷鍵: Ctrl+u
Dim RowN As Integer
Dim i As Integer, j As Integer
j = 6 '
X = Cells(ActiveSheet.Rows.Count, 6).End(xlUp).Row
For i = 1 To X '判定非空的最大行數RowN
If Cells(i, j).Value <> "" Then
RowN = i
End If
Next i
For i = RowN To 3 Step -1
If Cells(i, j) <> "" And (Cells(i, j) <> Cells(i - 1, j)) And Cells(i - 1, j) <> "" Then
Rows(i).Select
Selection.Insert Shift:=xlDown
End If
Next i
End Sub作者: starry1314 時間: 2016-7-21 15:59