View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
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