PC Review


Reply
Thread Tools Rate Thread

HOW CAN I DELETE A COLUMN BASED ON A CONDITION

 
 
ya
Guest
Posts: n/a
 
      16th Dec 2008
I want to delete an entire column if it is EMPTY

Please help
 
Reply With Quote
 
 
 
 
Gord Dibben
Guest
Posts: n/a
 
      17th Dec 2008
Sub DeleteEmptyColumns()
lastcol = ActiveSheet.Cells(ActiveCell.Row, _
Columns.Count).End(xlToLeft).Column
Application.ScreenUpdating = False
For r = lastcol To 1 Step -1
If Application.CountA(Columns(r)) = 0 Then
Columns(r).Delete
End If
Next r
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP


On Tue, 16 Dec 2008 15:43:01 -0800, ya <(E-Mail Removed)> wrote:

>I want to delete an entire column if it is EMPTY
>
>Please help


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting entries in column based on condition in another column =?Utf-8?B?Um9iZXJ0Ug==?= Microsoft Excel Worksheet Functions 1 8th Feb 2007 03:54 PM
Based on a condition in one column, search for a year in another column, and display data from another column in the same row >> look MPSingley@midamerican.com Microsoft Excel Programming 2 30th Dec 2006 06:23 PM
Based on a condition in one column, search for a year in another column, and display data from another column in the same row >> look MPSingley@midamerican.com Microsoft Excel Misc 0 27th Dec 2006 04:31 PM
how to count a column based on condition of another column =?Utf-8?B?UiBLaG9zaHJhdmFu?= Microsoft Excel Worksheet Functions 4 31st Aug 2006 05:25 PM
Unique values in column based on condition in another column emm8080 Microsoft Excel Worksheet Functions 3 16th Jul 2004 05:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:48 PM.