ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   hide rows which add up to zero (https://www.excelbanter.com/excel-discussion-misc-queries/208836-hide-rows-add-up-zero.html)

mohavv

hide rows which add up to zero
 
Hi,

I use the following code to hide the rows which add up to zero. But
the sheets is getting long, over 6000 rows, and it takes long to run
the macro.

Is there a quicker way?

Cheers,

Harold
-------------------------------------
Sub hide()

a = Range("z2").Value

For b = 3 To a

If Range("z" & b).Value = 0 Then
Rows(b).EntireRow.Hidden = True
Else
Rows(b).EntireRow.Hidden = False
End If

Next b

End Sub

Dave Peterson

hide rows which add up to zero
 
I don't see what you're adding here.

My suggestion would be to look at apply an autofilter to that column and filter
to hide rows with 0's in that column/field.



mohavv wrote:

Hi,

I use the following code to hide the rows which add up to zero. But
the sheets is getting long, over 6000 rows, and it takes long to run
the macro.

Is there a quicker way?

Cheers,

Harold
-------------------------------------
Sub hide()

a = Range("z2").Value

For b = 3 To a

If Range("z" & b).Value = 0 Then
Rows(b).EntireRow.Hidden = True
Else
Rows(b).EntireRow.Hidden = False
End If

Next b

End Sub


--

Dave Peterson


All times are GMT +1. The time now is 09:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com