View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove[_2_] Harlan Grove[_2_] is offline
external usenet poster
 
Posts: 1,231
Default Writing Macro in Excel 07

Shane Devenshire wrote...
try the following

Sub DeleteZeroRows()
* * Dim Bot As Long
* * Dim Col As Long
* * Bot = [B65536].End(xlUp).Row
* * Col = ActiveCell.Column
* * ActiveCell.EntireColumn.Insert
* * Range(Cells(1, Col), Cells(Bot, Col)).Select
* * Selection = "=IF(AND(RC[1]=0,NOT(ISBLANK(RC[1]))),1)"
* * Selection.SpecialCells(xlCellTypeFormulas, 1).EntireRow.Delete
* * ActiveCell.EntireColumn.Delete
End Sub

....

Not a good idea to insert/delete columns without checking whether
column IV were empty to begin with, and if column IV were empty you
could simply use it for the ancillary formulas then clear it when
done. The formula could then be shortened to

=1/COUNT(RC2)/(RC2=0)

And why are you performing the unnecessary .Select? Too busy to edit
that bit of the macro recorder output?