Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hidding rows with 0 as the value
i have the following code which i want to use for hiding rows which contain the value"0" in a certain column. The following code searches through the rows and hides the last row with a value of "0" in it but i need it to do this for other rows, not just the last one. I think it needs a loop in it aswell. Sub hide_rows() If Range("c8") = "0" Then rowhide = 1 If Range("c9") = "0" Then rowhide = 2 If Range("c10") = "0" Then rowhide = 3 If Range("c11") = "0" Then rowhide = 4 If Range("c12") = "0" Then rowhide = 5 If Range("c13") = "0" Then rowhide = 6 If Range("c14") = "0" Then rowhide = 7 If Range("c15") = "0" Then rowhide = 8 If Range("c16") = "0" Then rowhide = 9 If Range("c17") = "0" Then rowhide = 10 If Range("c18") = "0" Then rowhide = 11 If Range("c19") = "0" Then rowhide = 12 vrowhide = "" For rowselc = 1 To 12 If rowselc = 1 Then vrow = "8:8" If rowselc = 2 Then vrow = "9:9" If rowselc = 3 Then vrow = "10:10" If rowselc = 4 Then vrow = "11:11" If rowselc = 5 Then vrow = "12:12" If rowselc = 6 Then vrow = "13:13" If rowselc = 7 Then vrow = "14:14" If rowselc = 8 Then vrow = "15:15" If rowselc = 9 Then vrow = "16:16" If rowselc = 10 Then vrow = "17:17" If rowselc = 11 Then vrow = "18:18" If rowselc = 12 Then vrow = "19:19" Rows(vrow).EntireRow.Hidden = False If rowselc = rowhide Then Rows(vrow).EntireRow.Hidden = True End If Next rowselc End Sub ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hiding rows with 0 as the value
I couldn't figure out whether you wanted every row with a
zero hidden, or just the last one. The following code will hide every row where there is a zero in column C Sub HideRows2() dim X as integer for X= 8 to 19 IF cells(X,3).value = 0 THEN Rows(X).Hidden = true End if Next X End Sub Post back if this isn't what you were looking for, Pete |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Hidding rows when sorting | Excel Discussion (Misc queries) | |||
Hidding rows and colums | Excel Discussion (Misc queries) | |||
Hidding #DIV/0! In Cell | Excel Worksheet Functions | |||
Hidding #DIV/0! In Cell | Excel Worksheet Functions | |||
Hidding #DIV/0! In Cell | Excel Worksheet Functions |