How to delete multiple empty columns quickly in Excel?
Sometimes when you import data to Microsoft Excel from some source, such as web page, CSV, text, etc., there may be many empty columns with it. It must be time-consuming to delete each empty column one by one. Therefore, some of us search for easy ways to solve this problem. This article collects some tricky tips to help you delete multiple empty columns quickly.
Delete multiple blank / hidden / visible columns or rows at once:
Kutools for Excel's Delete Hidden (Visible) Rows & Columns utility can help you to delete multiple blank, hidden, visible rows or columns at once.
Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!
The Excel’s Go To Special Command can help you quickly select the multiple blank columns, and then you can delete them at once. You can do as the following steps:
1. Select the range containing the blank columns that you want to remove.
2. Click Home > Find & Select > Go To Special, in the Go To Special dialog box, check the Blanks option. See screenshot:
3. And then click OK, all of the blank columns of the selected range are highlighted. See screenshot:
4. Then click Home > Delete > Delete Sheet Columns, the blank rows have been deleted from the selected range. See screenshot:
If you'd like to use VBA macro, things goes much easier. The following VBA code may help you, please do as this:
1. Hold down the Alt + F11 keys in Excel, and it opens the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and paste the following macro in the Module Window.
VBA code: Delete multiple blank columns in selection:
Sub DeleteEmptyColumns() 'Updateby20140317 Dim rng As Range Dim InputRng As Range xTitleId = "KutoolsforExcel" Set InputRng = Application.Selection Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type:=8) Application.ScreenUpdating = False For i = InputRng.Columns.Count To 1 Step -1 Set rng = InputRng.Cells(1, i).EntireColumn If Application.WorksheetFunction.CountA(rng) = 0 Then rng.Delete End If Next Application.ScreenUpdating = True End Sub
3. Press the F5 key to run this macro. Select the work range you need to the pop out dialog. See screenshot:
4. Click OK, then all empty columns in the selection are removed. See screenshot:
The Delete Hidden (Visible) Rows & Columns utility of Kutools for Excel can help you quickly remove multiple empty rows or columns at once.
|Kutools for Excel : with more than 120 handy Excel add-ins, free to try with no limitation in 60 days.|
After installing Kutools for Excel, please do as this:
1. Click Kutools > Delete > Delete Hidden (Visible) Rows & Columns, see screenshot:
2. In the Delete Hidden (Visible) Rows & Columns dialog box, specify the scope that you want to apply the operation from Look in drop down list. (If you choose In Selected Range, you must select a range that you want to use first.) And then check Columns under Delete type. And select Blank columns from Detailed type. See screenshot:
3. Then click OK. And the blank columns have been deleted from the selected range. See screenshots:
To know more about this feature, please visit the Delete Rows & Columns function.
Recommended Productivity Tools
Bring handy tabs to Excel and other Office software, just like Chrome, Firefox and new Internet Explorer.
Amazing! Increase your productivity in 5 minutes. Don't need any special skills, save two hours every day!
200 New Features for Excel, Make Excel Much Easy and Powerful:
- Merge Cell/Rows/Columns without Losing Data.
- Combine and Consolidate Multiple Sheets and Workbooks.
- Compare Ranges, Copy Multiple Ranges, Convert Text to Date, Unit and Currency Conversion.
- Count by Colors, Paging Subtotals, Advanced Sort and Super Filter,
- More Select/Insert/Delete/Text/Format/Link/Comment/Workbooks/Worksheets Tools...