Solved

Excel 2007 Delete Columns when rows below are blank

Posted on 2014-09-30
2
315 Views
Last Modified: 2014-09-30
Hello Experts,

I need to be able to cut down on the amount of blank columns I have in a spreadsheet.  Each column has a title and below the title there may be some cells which are populated and some which are not.  I want to delete any column which has only blank cells beneath the title.

I have attached an example of the spreadsheet.  The first five rows will always blank.

Regards,
Infosec36
Remove-Blank-Columns.xls
0
Comment
Question by:Sonia Bowditch
2 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 500 total points
ID: 40352003
Sub DeleteColumns()
intcol = 1
Do While Cells(6, intcol) = "OVERRIDE"
    If Application.WorksheetFunction.CountA(Columns(intcol)) = 1 Then
        Columns(intcol).Delete
    Else
        intcol = intcol + 1
    End If
Loop
End Sub

Open in new window

0
 

Author Closing Comment

by:Sonia Bowditch
ID: 40352008
Thank you so much for the quick response.  It works perfectly and is exactly what I needed.

Regards,
InfoSec36
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question