Formula:
[list=1][*]Open your Excel workbook and press Alt + F11 to open the Visual Basic Editor.[*]In the Project Explorer window, find the worksheet where you want to monitor for changes and double-click it to open the code window.[*]Copy and paste the code above into the code window.[*]Change the cell reference in the code to the cell you want to monitor for changes. In this example, it's set to monitor cell A1 on Sheet1.[*]Save your workbook and close the Visual Basic Editor.[/list]
Here's a VBA code that will do what you're looking for:
Formula:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then 'Change this to the cell you want to monitor for changes
If Target.Value = 0 Then
Sheets("Sheet2").Rows(5).Hidden = True
Else
Sheets("Sheet2").Rows(5).Hidden = False
End If
End If
End Sub
Now, whenever the value in the cell you're monitoring changes, the code will check if it's equal to 0. If it is, it will hide row 5 on Sheet2. If it's greater than 0, it will unhide row 5 on Sheet2.