Automatic hiding of rows

G

Greg

Hello,

We are looking for a macro or a driver to do the
following. Please assist.

We have a spreadsheet with thousands of rows and four
columns. 2 out of the 4 columns are of great importance,
in which when both of those column contain a zero for the
same row we want to run a macro in which those rows will
be automatically hidden.

For those rows with values other than one, then they
should remain in the spreadsheet.

Thanks in advance.
 
D

Don Guillett

something like this might work
Sub hideifzeros()
For Each c In Selection
If c = 0 And c.Offset(0, 3) = 0 Then c.EntireRow.Hidden = True
Next
End Sub
 
D

Don Guillett

In answer to your private post

If you left the if all on one line NO error.
I suspect you added too many conditions. So you would need a continuation
line or

for
if then
do stuff
end if
next

or
for
if this and that and the other and etc _
and even more and even more then _
do stuff
'no end if needed
next
 
Top