Thread: Macros
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Bridges[_2_] Bob Bridges[_2_] is offline
external usenet poster
 
Posts: 257
Default Macros


Now, I've been writing in VBA for Excel only a few years myself so I ask in
ignorance. But if we already know CellObj.Value = 0, what point can there be
in also asking whether CellObj.Value < "" or Not IsEmpty(CellObj)? Doesn't
the first test tell us everything we need to know? Seems to me the two lines
I've commented out below are simply wasted space. What am I missing?

--- "JLGWhiz" wrote:
Sub delZeros()
lr = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row
For i = lr To 2 Step -1
With ActiveSheet
If .Range("B" & i).Value = 0 _
' And .Range("B" & i).Value < "" _
' And Not IsEmpty(.Range("B" & i)) _
Then .Rows(i).Delete
End With
Next i
End Sub

--- "TSVillanova"
I am new a writing macros and am having a problem
writing one that will let me delete all rows that have a
0 value in cells of column "B" while leaving all of the
other rows with cells that have values and are blank.