Welcome to the MrExcel Message Board!
We need VBA help to solve this problem. The code is supposed to check if the changed cell is D4, then check its value, and if it is 10000 then hide the rows, otherwise, show the rows.
Right click on the worksheet tab, and click on the View Code command. Find the Worksheet_Change event procedure and copy and paste the following code.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("D4")) Is Nothing Then
Rows("62:75").Hidden = Target.Value = 10000
End If
End Sub
This is a very specific solution to show you how it would work according to the sample you provided. The "If" condition could be expanded by using multiple ElseIf statements for different values and cells, and it depends on your exact need.
Side note: If D4 is a formula cells instead of user entry, then this solution won't work. In that case, you can use the following version. I personally don't like using the Worksheet_Change event procedure like this as it will be called at each cell change on the worksheet), but we need an event trigger to check the cell value.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Rows("62:75").Hidden = Range("D4").Value = 10000
End Sub
Another side note: If D4 formula depends on another worksheet cell value, then we'll need to use Thisworkbook class object's Workbook_SheetChange event procedure to be able to catch the value change in D4 based on the other worksheet cell changing. But it is another story and hopefully this is not the case. However, let us know if that's the case.