Hide rows within a range IF...

  • Thread starter Thread starter drumsab
  • Start date Start date
D

drumsab

Greetings,
Newbie here so any help is appreciated.

Within the active worksheet, within the row range of Row 7 thru Row 1004, if
the value in Column CK for that Row is = 0, then hide the entire row.
 
One way
sub hideifzero()
for i=1004 to 2 step-1
if cells(i,"ck")=0 then rows(i).hidden=true
next i
end sub
 
Thanks.

My spreadsheet is fairly big. Any way to make the "hiding rows" go faster
than it does with this code?
 
Modify this to suit

Sub FilterOutZero()
Range("a1").AutoFilter Field:=1, Criteria1:="<>0"
End Sub
 
Or assisgn this to a shape or button from the drawing toolbar

Sub ToggleAutoFilter()
If ActiveSheet.AutoFilterMode Then
ActiveSheet.AutoFilterMode = False
Else
Range("ck1").AutoFilter Field:=1, Criteria1:="<>0"
End If
End Sub
 

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