Solved

Excel 2007 Delete Columns when rows below are blank

Posted on 2014-09-30
2
319 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

733 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