Excel - How to delete blank columns
If you followed the previous macros here is a routine to delete blank columns.
Sub DeltBlnkCol() 'I like to save the current address so I can come back to it C = ActiveCell.Address 'I save the last column of data in "D" D = Cells.Find("*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column 'Keep going through all the columns that contain data While ActiveCell.Column <= D ' Check to see if the column is empty If WorksheetFunction.CountA(Selection.EntireColumn) = 0 Then ' If it is empty delete it Selection.EntireColumn.Delete ' Decrement the number of columns that contain data as one was just deleted D = D - 1 Else ' If is is not empty go to the next column to test it ActiveCell.Offset(0, 1).Select End If Wend Ender: 'Go back to original starting place ActiveSheet.Range(C).Select End Sub