A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Is there an easy way to delete empty columns?



 
 
Thread Tools Display Modes
  #1  
Old September 8th, 2008, 08:33 PM posted to microsoft.public.excel.worksheet.functions
Acanesfan
external usenet poster
 
Posts: 21
Default Is there an easy way to delete empty columns?

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?
--
Thank you.
Jayne
  #2  
Old September 8th, 2008, 09:01 PM posted to microsoft.public.excel.worksheet.functions
Héctor Miguel
external usenet poster
 
Posts: 298
Default Is there an easy way to delete empty columns?

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.


  #3  
Old September 8th, 2008, 09:01 PM posted to microsoft.public.excel.worksheet.functions
Gary''s Student
external usenet poster
 
Posts: 7,584
Default Is there an easy way to delete empty columns?

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
--
Gary''s Student - gsnu200803


"Acanesfan" wrote:

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?
--
Thank you.
Jayne

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:49 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.