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 empty columns with Go To Special Command

Delete multiple empty columns with VBA code

Delete multiple empty columns with Kutools for Excel

Kutools for Excel: add 120 new features in Excel. Save one hour every day.
Classic Menu for Office: brings back classic menus to Office 2010 and 2013 (includes Office 365).
Office Tab: brings tabbed interface to Office as the use of web browser Chrome, Firefox and Internet Explorer.

arrow blue right bubble Delete multiple empty columns with Go To Special Command

Hot
Amazing! Using Tabs in Excel like Firefox, Chrome, Internet Explore 10!

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. See screenshot:

3. In the Go To Special dialog box, check the Blanks option.

4. And then click OK, all of the blank columns of the selected range are highlighted.

5. Then click Home > Delete > Delete Sheet Columns, the blank rows have been deleted from the selected range. See screenshots:

-1


arrow blue right bubble Delete multiple empty columns with VBA

If you'd like to use VBA macro, things goes much easier. Here are two VBA macros for you.

1. Delete empty columns in selection

Step 1: Select the range that you will work with.

Step 2: Hold down the Alt + F11 keys in Excel, and it opens the Microsoft Visual Basic for Applications window.

Step 3: Click Insert > Module, and paste the following macro in the Module Window.

VBA for deleting 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

Step 4: Press the F5 key to run this macro. Select the work range you need to the pop out dialog. See screenshot:

Step 5: Click OK, then all empty columns in the selection are removed. See screenshot:

2. Delete empty columns in the whole using working area

Step 1: Hold down the Alt + F11 keys in Excel, and it opens the Microsoft Visual Basic for Applications window.

Step 2: Click Insert > Module, and paste the following macro in the Module Window.

Sub DelEmptyCols()
'Updateby20140317
Dim rng As Range
xTitleId = "KutoolsforExcel"
Set InputRng = Application.ActiveSheet.UsedRange
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

Step 3: Press the F5 key to run this macro. Then all columns in the active worksheet are removed.


arrow blue right bubble Delete multiple empty columns with Kutools for Excel

The Delete 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 30days. Get it Now.

After installing Kutools for Excel, please do as this:

1. Click Kutools > Delete Tools > Delete Rows & Columns, see screenshot:

doc-delete-blank-columns5

2. In the Delete 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:

doc-delete-blank-columns6

3. Then click OK. And the blank columns have been deleted from the selected range. See screenshots:

doc-delete-blank-columns7
-1
doc-delete-blank-columns8

To know more about this feature, please visit the Delete Rows & Columns function.


Related articles:


Kutools for Excel

More than 120 Advanced Functions for Excel 2013, 2010, 2007 and Office 365.

screen shot

btn read more     btn download     btn purchase

 

 

Comments  

0#KJ St.Piere2014-01-03 01:18
I found it much simpler to go to the line after my last line of data, enter "Shift-Ctrl-End" to highlight all blank lines that followed(much faster), right click and enter "delete all rows/columns". The system didn't waste so much time searching this way and so it was clean in the blink of an eye and files that were 20 MB were dropped to a size of 20 kb.
Reply | Reply with quote | Quote
0#KARTHIKEYAN2014-02-01 10:08
the above details are very helpful for my personal use. Thanks for your guidance.

M.KARTHIKEYAN :-)
Reply | Reply with quote | Quote

Add comment


Security code
Refresh