Sub DeleteEmptyRows() Dim LastRow As Long, r As Long LastRow = ActiveSheet.UsedRange.Rows.Count LastRow = LastRow + ActiveSheet.UsedRange.Row - 1 For r = LastRow To 1 Step -1 If WorksheetFunction.CountA(Rows(r)) = 0 Then Rows(r).Delete Next r End Sub ‘删除空列 Sub DeleteEmptyColumns() Dim LastColumn As Long, c As Long LastColumn = ActiveSheet.UsedRange.Columns.Count LastColumn = LastColumn + ActiveSheet.UsedRange.Column For c = LastColumn To 1 Step -1 If WorksheetFunction.CountA(Columns(c)) = 0 Then Columns(c).Delete Next c End Sub
Excel删除空白行和列
Posted helloDali
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Excel删除空白行和列相关的知识,希望对你有一定的参考价值。
以上是关于Excel删除空白行和列的主要内容,如果未能解决你的问题,请参考以下文章