Results 1 to 4 of 4
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Posts
    1,418
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Is there a way to hide a row if there is a zero entered in a particular cell in the row?
    Thanks.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You could run a macro that checks the values in a particular column and hides / unhides the row depending on whether the value is 0.

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Posts
    1,418
    Thanks
    1
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='761025' date='24-Feb-09 11:53']You could run a macro that checks the values in a particular column and hides / unhides the row depending on whether the value is 0.[/quote]*Hans,Do you have such a macro perhaps?Thanks,JeffPS:* I really like the new layout...

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Try this (change "D" to the column you want to use):
    Code:
    Sub HideRowsWithZeros()
      ' Change as needed
      Const strCol = "D"
      Dim r As Long
      Dim m As Long
      m = Cells(Rows.Count, strCol).End(xlUp).Row
      For r = 1 To m
    	Cells(r, strCol).EntireRow.Hidden = _
    	  (Not Cells(r, strCol) = "" And Cells(r, strCol) = 0)
      Next r
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •