Is there an easy way to delete empty columns?

A

Acanesfan

I am using Excel 2007.

I have a spreadsheet that has been exported from an in-house software
database. It has 57 columns and more than 1,000 rows. A lot of the columns
are totally blank. Other than finding them manually is there an easier way
to delete them?
 
H

Héctor Miguel

hi, !
I am using Excel 2007.
I have a spreadsheet that has been exported from an in-house software database.
It has 57 columns and more than 1,000 rows. A lot of the columns are totally blank.
Other than finding them manually is there an easier way to delete them?

1) select the entire row (say) of your titles
2) {F5} > (button) special... > blank cells > accept
3) right-click > delete... > entire column

hth,
hector.
 
G

Gary''s Student

Sub colkiller()
Set r = ActiveSheet.UsedRange
nLastColumn = r.Columns.Count + r.Column - 1
For i = nLastColumn To 1 Step -1
Set rcol = Cells(1, i).EntireColumn
If Application.WorksheetFunction.CountA(rcol) = 0 Then
rcol.Delete Shift:=xlToLeft
End If
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top