The code below deletes columns with all empty cells in the entire column. I need to alter it to delete columns with all empty cells in the entire column, only if there is a column header. I want the columns with no header and no cell data to remain.
Thanks for any assistance!
Dim X As Long, LastRow As Long, LastCol As Long
LastRow = Cells.Find("*", , xlValues, , xlRows, xlPrevious).Row
LastCol = Cells(1, Columns.count).End(xlToLeft).Column
Application.ScreenUpdating = False
For X = LastCol To 1 Step -1
If Cells(1, X).Value = Join(Application.Transpose(Cells(1, X).Resize(LastRow)), "") Then Columns(X).Delete
Next
Application.ScreenUpdating = True