Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hidding rows when sorting jodleren Excel Discussion (Misc queries) 1 June 1st 10 10:51 PM
Hidding rows and colums msao Excel Discussion (Misc queries) 1 November 17th 09 07:12 PM
Hidding #DIV/0! In Cell Susan Excel Worksheet Functions 1 May 23rd 07 10:36 PM
Hidding #DIV/0! In Cell Harlan Grove[_2_] Excel Worksheet Functions 0 May 23rd 07 07:41 PM
Hidding #DIV/0! In Cell Susan Excel Worksheet Functions 0 May 23rd 07 07:15 PM


All times are GMT +1. The time now is 08:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"