|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim rng As Range
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- With Worksheets("数据")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a1:f" & r)
- Set rng = .Rows(r + 1)
- For i = 1 To UBound(arr)
- If Len(arr(i, 1)) = 0 Then
- Set rng = Union(rng, .Rows(i))
- End If
- Next
- rng.Delete
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a1:f" & r)
- For i = UBound(arr) To 3 Step -1
- If arr(i, 2) <> arr(i - 1, 2) Then
- x = Application.Ceiling(arr(i - 1, 3), 8) - arr(i - 1, 3)
- If x <> 0 Then
- .Rows(i).Resize(x).Insert
- End If
- End If
- Next
- End With
- Application.ScreenUpdating = True
- MsgBox "数据处理完毕!"
- End Sub
复制代码 |
|