20170821xlVBA隐藏空行

Sub HideBlankRowsBetweenUsedRange()
Dim URows As Range, i As Long, EndRow As Long
With ActiveSheet
EndRow = .Cells.Find("*", .Cells(1, 1), xlValues, xlWhole, xlByRows, xlPrevious).Row
For i = 1 To EndRow
If Application.WorksheetFunction.CountA(.Rows(i)) = 0 Then
If URows Is Nothing Then
Set URows = .Rows(i)
Else
Set URows = Union(URows, .Rows(i))
End If
End If
Next i
If Not URows Is Nothing Then URows.EntireRow.Hidden = True
End With
Set URows = Nothing
End Sub

  

上一篇:DevOps适用于小团队吗?


下一篇:ruby 基础知识2 - 区块 block