Sub Main() Dim i As Long, x As Range: Application.ScreenUpdating = False With ActiveSheet.UsedRange For i = 1 To 3: .Replace Space(i), "", xlWhole: Next .Value = .Value For i = 1 To .Row + .Rows.Count - 1 If Rows(i).Text = "" Then If x Is Nothing Then Set x = Rows(i) Else Set x = Union(x, Rows(i)) Next If Not x Is Nothing Then x.Delete Set x = Nothing For i = 1 To .Column + .Columns.Count - 1 If Columns(i).Text = "" Then If x Is Nothing Then Set x = Columns(i) Else Set x = Union(x, Columns(i)) Next If Not x Is Nothing Then x.Delete End With End Sub |