Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ya Ya is offline
external usenet poster
 
Posts: 3
Default HOW CAN I DELETE A COLUMN BASED ON A CONDITION

I want to delete an entire column if it is EMPTY

Please help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default HOW CAN I DELETE A COLUMN BASED ON A CONDITION

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 wrote:

I want to delete an entire column if it is EMPTY

Please help


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Rows based on condition Vic Excel Discussion (Misc queries) 2 August 18th 09 08:54 PM
Delete worksheet row based on condition miek Excel Programming 3 August 23rd 07 07:16 PM
How to delete a data row based on a condition wmc New Users to Excel 4 April 18th 07 02:40 PM
Is there a way to delete a cell value based on a condition? Peanut Excel Discussion (Misc queries) 2 October 2nd 06 09:55 PM
Delete Columns based on a condition Joel Mills Excel Programming 3 August 6th 04 07:21 PM


All times are GMT +1. The time now is 04:48 AM.

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

About Us

"It's about Microsoft Excel"