How to delete empty columns with header in Excel?
If you have a large worksheet which contains multiple columns, but some of the columns only contain a header, and now, you want to delete these empty columns which contain only a header to get the following screenshot shown. Is this can be solved in Excel quickly and easily?

Delete empty columns with a header by using VBA code
Delete multiple empty columns in a range / worksheet / workbook with Kutools for Excel
Comparison of Methods for Deleting Empty Columns in Excel
When a large worksheet contains unnecessary columns, the right deletion method depends on whether the columns contain only headers or are completely blank. VBA can identify and delete columns that contain no data beyond a header, while Kutools for Excel provides a direct way to remove completely blank columns across different scopes.
| Comparison | VBA | Kutools Delete Hidden (Visible) Rows & Columns |
|---|---|---|
| Deletion rule | Deletes columns containing no more than one non-empty cell, including columns with only a header and completely blank columns | Deletes completely blank columns |
| Scope | Current worksheet in the provided VBA example | Choose the required scope, such as a selected range, worksheet, or workbook |
| Setup | Open the VBA editor, insert a module, paste the code, and run the macro | Open the dialog, choose the scope, select Columns, and then choose Blank columns |
| Best for | Deleting columns that contain a header but no additional data | Quickly removing completely blank columns from a specified range, worksheet, or workbook without VBA |
Delete empty columns with a header by using VBA code
In Excel, there is no direct method to deal with this job excepting delete them one by one manually, but, here, I can introduce a code for you, please do as follows:
1. Hold down the ALT + F11 keys, then it opens the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and paste the following code in the Module Window.
VBA code: Delete empty columns with a header:
Sub Macro1()
'updateby Extendoffice
Dim xEndCol As Long
Dim I As Long
Dim xDel As Boolean
On Error Resume Next
xEndCol = Cells.Find("*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
If xEndCol = 0 Then
MsgBox "There is no data on """ & ActiveSheet.Name & """ .", vbExclamation, "Kutools for Excel"
Exit Sub
End If
Application.ScreenUpdating = False
For I = xEndCol To 1 Step -1
If Application.WorksheetFunction.CountA(Columns(I)) <= 1 Then
Columns(I).Delete
xDel = True
End If
Next
If xDel Then
MsgBox "All blank columns with only headers are deleted.", vbInformation, "Kutools for Excel"
Else
MsgBox "There are no Columns to delete as each one has more data (rows) than just a header.", vbExclamation, "Kutools for Excel"
End If
Application.ScreenUpdating = True
End Sub
3. Then press F5 key to run this code, and a prompt box will pop out to remind you the blank columns with header will be deleted.
4. Click OK, all the blank columns with only headers in current worksheet are deleted at once.
Note: If there are blank columns, they will be deleted as well.
Delete multiple empty columns in a range / worksheet / workbook with Kutools for Excel
Sometimes, you just only need to delete the blank columns, the Kutools for Excel’s Delete Hidden (Visible) Rows & Columns utility can help you to finish this task with ease.
After installing Kutools for Excel, please do as follows:
1. Select the columns range which include the blank columns need to be deleted.
2. Then click Kutools > Delete > Delete Hidden (Visible) Rows & Columns, see screenshot:

3. In the Delete Hidden (Visible) Rows & Columns dialog box, you can select the delete scope from the Look in drop down as you need, select Columns from the Delete type section, and then choose Blank columns from the Detailed type section, see screenshot:
4. Then click Ok button, and only the empty columns are deleted at once. See screenshot:

Tips: With this powerful feature, you can also delete blank rows, visible columns or row, hidden columns or rows as you need.
Conclusion
VBA is the more targeted solution when the worksheet contains columns with headers but no data underneath. The code shown in the article checks each column and deletes it when the entire column contains no more than one non-empty cell. As a result, it removes both columns containing only a header and completely blank columns.
Kutools for Excel's Delete Hidden (Visible) Rows & Columns provides a simpler no-code solution when the goal is to remove completely blank columns. You can choose the deletion scope, select Columns, and then choose Blank columns to remove empty columns in one operation. The same utility can also be used to manage blank rows, visible rows or columns, and hidden rows or columns.
Kutools for Excel - Supercharge Excel with over 300 essential tools, making your work faster and easier, and take advantage of AI features for smarter data processing and productivity. Get It Now
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
All Kutools add-ins. One installer
Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.
- All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
- One installer, one license — set up in minutes (MSI-ready)
- Works better together — streamlined productivity across Office apps
- 30-day full-featured trial — no registration, no credit card
- Best value — save vs buying individual add-in
