Sub 隐藏空白行与列()
Dim i&, j&, k&, l&
ActiveSheet.UsedRange.Select
i = Selection(Selection.Count).Row
j = Selection(Selection.Count).Column
For k = 1 To i
If WorksheetFunction.CountA(Rows(k)) = 0 Then Rows(k).Hidden = True
Next
For l = 1 To j
If WorksheetFunction.CountA(Columns(l)) = 0 Then Columns(l).Hidden = True
Next
Columns(j + 1).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.EntireColumn.Hidden = True
Rows(i + 1).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.EntireRow.Hidden = True
End Sub