Using VBA how can I select all the columns with headers in Excel? or all the columns which are not blank? Basically select all the columns with data in them.
Autofit columns with data
Sub AutoFit()
Rows("1:1").SpecialCells(xlCellTypeConstants, 23).Columns.AutoFit
End Sub
Or possibly
Sub AutoFitCell()
Cells.SpecialCells(xlCellTypeConstants, 23).Columns.AutoFit
End Sub