• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

hide rows based on criteria

Hello
this code hides rows that in c column the value is 0
i want the c.value to be between -1 and +1
i tried some things but fails any help?

Code:
Sub HideRowelypol()
Application.ScreenUpdating = False
Application.Calculation = xlManual
For Each c In Range("c2:c1199")
  If c.Value = 0 Then Rows(c.Row).Hidden = True
Next
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
End Sub
 
Last edited by a moderator:
Code:
Sub HideRowelypol()
Application.ScreenUpdating = False
Application.Calculation = xlManual
For Each c In Range("c2:c1199")
  If c.Value > -1 and  c.Value < 1 Then Rows(c.Row).Hidden = True
Next
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
End Sub
 
Hi,

You can not hide single cell ...you need to hide the entire row belonging to that cell.
Code:
Sub HideRowelypol()
Application.ScreenUpdating = False
Application.Calculation = xlManual
For Each c In Range("c2:c1199")
  If c.Value = 0 Then c.EntireRow.Hidden = True
Next
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
End Sub
 
Hello
this code hides rows that in c column the value is 0
i want the c.value to be between -1 and +1
i tried some things but fails any help?

Code:
Sub HideRowelypol()
Application.ScreenUpdating = False
Application.Calculation = xlManual
For Each c In Range("c2:c1199")
  If c.Value = 0 Then Rows(c.Row).Hidden = True
Next
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
End Sub
your code also running fine for me
 
Back
Top