If formula question

J

jeff

What I am trying to do is, if a cell=0 then I want to delete out a
block of lines, but if it is >0 then the lines dont get deleted.

Is this possible??
 
D

Dennis Carr

What I am trying to do is, if a cell=0 then I want to delete out a block
of lines, but if it is >0 then the lines dont get deleted.

Is this possible??

Not that I'm aware, but this is a bad idea though, simply because to have
data self-destruct given certain arbitrary conditions is a Bad Thing. One
good bug and you're screwed. You can probably do this through a macro,
but trust me. Don't.

Rather, formulas that you want to vanish should basically disappear when
zeroed out - if the condition exists (a given cell < 1), an IF statement
in the cells you want to hide would contain the following:

IF ($r$c=0,0,(whatever formula goes here))

This also assumes you have turned off the "show zeroes" option in
Tools|Options.
 
B

BrianB

Here is a macro which you will probably need to amend to fit your exact needs :-
'---------------------------------------------
Sub DELETE()
Dim FirstRow As Long
Dim LastRow As Long
Dim rw As Long
'----------------------
FirstRow = 1
LastRow = 10
For rw = FirstRow To LastRow
'- checks column A. Amend if necessary.
If ActiveSheet.Range("A" & rw).Value = 0 Then
Rows(rw).EntireRow.Delete
End If
Next
End Sub
'----------------------------------------------


Regards
BrianB
==============================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top