ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide rows within a range IF... (https://www.excelbanter.com/excel-programming/401676-hide-rows-within-range-if.html)

drumsab

Hide rows within a range IF...
 
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.

Don Guillett

Hide rows within a range IF...
 

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
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"drumsab" wrote in message
...
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.



drumsab

Hide rows within a range IF...
 
Thanks.

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

"Don Guillett" wrote:


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
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"drumsab" wrote in message
...
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.




Don Guillett

Hide rows within a range IF...
 
Modify this to suit

Sub FilterOutZero()
Range("a1").AutoFilter Field:=1, Criteria1:="<0"
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"drumsab" wrote in message
...
Thanks.

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

"Don Guillett" wrote:


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
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"drumsab" wrote in message
...
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.





Don Guillett

Hide rows within a range IF...
 
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


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message
...
Modify this to suit

Sub FilterOutZero()
Range("a1").AutoFilter Field:=1, Criteria1:="<0"
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"drumsab" wrote in message
...
Thanks.

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

"Don Guillett" wrote:


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
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"drumsab" wrote in message
...
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.






All times are GMT +1. The time now is 05:15 PM.

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