0

I'm stuck with what is probably a stupid question. "How to find a cell where the formula returns an answer of 0 (zero) Column A contains x rows of formula adding each row Column B to D =SUM(B4:D4) Im trying to delete all rows where is finds this value.

Columns("A:A").Select
Selection.Find(What:="0", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
    xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
    , SearchFormat:=True).Activate
strDelRow = Activecell.Row
Rows("" & StrDelRow &":" & StrDelRow).Select
Selection.Delete Shift:=xlUp

...but - it can find the zeros as they are in a formula? Anyone to possibly help?

Many thanks,

Ian

4

3 回答 3

1

是的,它可以找到返回零的公式。

看起来您正在选择整个 A 列并寻找零,尝试更改代码如下

Range("A1").Select 'Start at the top

Range("A:A").Find(What:="0", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
    xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
    , SearchFormat:=False).Activate
于 2013-08-05T13:09:41.070 回答
1

试试这个:

Sub dural()
    Dim N As Long, NN As Long
    NN = Cells(Rows.Count, "A").End(xlUp).Row
    For N = NN To 1 Step -1
        If Cells(N, 1).Value = 0 Then
            Cells(N, 1).EntireRow.Delete
        End If
    Next
End Sub
于 2013-08-05T13:12:39.667 回答
0

将特殊值复制/粘贴到另一列中,然后将其用于删除代码

于 2013-08-05T13:07:29.303 回答