• 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.

Need formula to hide row based on cell value

2 Options


1. Conditional Format

Say A5 has a value

and when A5 = 10 Hide all Row 5

Use Conditional Format apply to Row $5:$5

Use Formula with =$A5=10 and apply White Font White Background


2. Write a small macro to check and hide row as appropriate.

Copy and paste this into a code page for the sheet yopu are working on

Adjust values to suit

[pre]
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myAdd As String
Dim myVal As Double
Dim mySht As String
Dim myRow As Integer

mySht = "Sheet1" ' Change to suit
myAdd = "$A$10" ' Cell to check; Change to suit
myVal = 20 ' Check for this value; Change to suit
myRow = 10 ' Hide this row; Change to suit

If Target.Address = myAdd And Target.Value = myVal Then
Worksheets(mySht).Rows(myRow).Hidden = True
ElseIf Target.Address = myAdd And Target.Value <> myVal Then
Worksheets(mySht).Rows(myRow).Hidden = False
End If

End Sub
[/pre]
 
Thanks for your reply.

Is the any way the above can be achieved using formulas only....

Bcoz macro code is not supported on unix platform.
 
Back
Top