Automatic hiding of rows

  • Thread starter Thread starter Greg
  • Start date Start date
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.
 
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
 
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
 

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

Back
Top