ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete Columns if sum is 0 (https://www.excelbanter.com/excel-programming/442825-delete-columns-if-sum-0-a.html)

beancurd

Delete Columns if sum is 0
 
Hi,

I want to delete columns if the total is 0
background: excel file columns I to X want to delete if whole column's
SUM is 0.

JLGWhiz[_2_]

Delete Columns if sum is 0
 
Sub delCol()
Dim lr As Long, sh As Worksheet
Set sh = ActiveSheet
For i = 24 To 9 Step -1
lr = sh.Cells(Rows.Count, i).End(xlUp).Row
If WorksheetFunction.Sum(Range(sh.Cells(1, i), _
sh.Cells(lr, i))) = 0 Then
Columns(i).Delete
End If
Next
End Sub




"beancurd" wrote in message
...
Hi,

I want to delete columns if the total is 0
background: excel file columns I to X want to delete if whole column's
SUM is 0.




beancurd

Delete Columns if sum is 0
 
How can I set the pop up message, for one folder that include excel
file to delete columns?

Gord Dibben

Delete Columns if sum is 0
 
Start by re-writing your description of what you would like to have done.

Does not make sense as it is.


Gord Dibben MS Excel MVP

On Thu, 27 May 2010 09:04:04 -0700 (PDT), beancurd
wrote:

How can I set the pop up message, for one folder that include excel
file to delete columns?




All times are GMT +1. The time now is 08:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com