Hi this macro will delete any empty rows or empty columns.
I'm not sure where you would want to place any odd blank
cells, filled from below? or right?
Sub testdel()
Dim nr As Long, r As Long, count As Long
Dim nc As Integer, c As Integer
Dim rng As Range
Dim v
Selection.SpecialCells(xlCellTypeLastCell).Select
nr = ActiveCell.Row
nc = ActiveCell.Column
For c = 1 To nc
Set rng = Range(Cells(1, c), Cells(nr, c))
count = 0
For Each v In rng
If IsEmpty(v) Then
count = count + 1
End If
Next v
If count = nr Then
rng.EntireColumn.Delete
End If
Next c
Selection.SpecialCells(xlCellTypeLastCell).Select
nr = ActiveCell.Row
nc = ActiveCell.Column
For r = 1 To nr
count = 0
Set rng = Range(Cells(r, 1), Cells(r, nc))
For Each v In rng
If IsEmpty(v) Then
count = count + 1
End If
Next v
If count = nc Then
rng.EntireRow.Delete
End If
Next r
End Sub
Press Alt+ F11 to open VB Editor,choose insert macro and
paste the code
You can run it from the VB Editor (Press F5) or return to
the sheet and press Alt + F8, select the macro and choose
Run. MAke sure that you are in the correct sheet.
(e-mail address removed)
regards
Peter