AussieJames
Hi kat ... hmmm - what do you mean "no effect" The code sample I wrote doesn't check for empty rows, it loops through every column then checks every cell (row by row) in the column aggregating the text values to a holding variable and if that variable becomes non-empty before the last row of the spreadsheet (that has data in it) then the column is non-empty and it goes to the next one. If the variable remains empty to the bottom of the column, the column is empty and it is deleted ...
In any case ... I had a thought about making this more elegant ... How's this:
========
Sub DeleteEmptyColumns2()
Dim intLastCol As Integer
Dim lngLastRow As Long
Dim i As Integer
intLastCol = Range("A1").SpecialCells(xlCellTypeLastCell).Column
For i = 1 To intLastCol
Cells(1, i).Select
lngLastRow = Cells(1, i).End(xlDown).Row
If lngLastRow = 65536 And IsEmpty(Cells(lngLastRow, i)) Then
Cells(1, i).EntireColumn.Delete
i = i - 1
intLastCol = intLastCol - 1
If i > intLastCol Then GoTo BreakLoop
End If
Next i
BreakLoop:
End Sub
========
Let me know if you still have problems running this ...
Aussie James.