Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 4th, 2005, 05:20 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default delete/ignore empty column

I have this small table within my Excel spreadsheet, but is there a way i can automatically ignore or delete columns that are empty? say in between the min stay and the max stay columns?


Class Min Stay Max Stay
M 2 Nts/Sat Night 6 Months
Q 2 Nts/Sat Night 3 Months
W 2 Nts/Sat Night 3 Months
E 2 Nts/Sat Night 1 Month
N 2 Nts/Sat Night 1 Month


www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old May 4th, 2005, 08:01 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi

Try this one

Sub DeleteColumns()
Dim i As Integer
For i = ActiveSheet.UsedRange.Columns.Count To 1 Step -1
    If WorksheetFunction.CountA(Columns(i)) = 0 Then
        Columns(i).Delete
    End If
Next
End Sub

-vemaju






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to select only the parent tag and ignore the c Prem Rajesh Kumar XSLT 3 November 6th, 2007 12:53 PM
Ignore this post...its crap! clandestine XML 4 May 31st, 2005 06:38 AM
Delete all empty worksheets crmpicco Excel VBA 2 May 10th, 2005 07:08 AM
delete all empty cells and move them to the left crmpicco Excel VBA 1 May 6th, 2005 05:47 AM
Delete a column from an ADO recordset. madkaikar_ashish Classic ASP Professional 1 September 11th, 2004 09:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.