|
yjwdjfqb 发表于 2014-3-20 08:30
请大师们帮帮忙,这个功能可能大家也会用到的哟!
不知道这样会不会快一点?请测试:- Sub 删除空行() Dim Rng As Range, Rngs As Range, cell As Range
- Dim i%, Num%, irow, iAdd$
- Application.ScreenUpdating = False
- Set Rng = ActiveSheet.UsedRange
- If Rng.Count > 1 Then iAdd = Mid(Rng.Address, InStr(Rng.Address, ":") + 1, 10)
- Set cell = Range("a1", iAdd)
- For i = 1 To cell.Rows.Count
- iAdd = ""
- Num = WorksheetFunction.CountBlank(Intersect(cell, Rows(i)))
- If Num = cell.Columns.Count Then
- iAdd = iAdd & i & ","
- If Rngs Is Nothing Then
- Set Rngs = Cells(i, 1)
- Else
- Set Rngs = Union(Rngs, Cells(i, 1))
- End If
- End If
- Next
- If Not Rngs Is Nothing Then Rngs.EntireRow.Delete
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|