If the values in Column (D) rows (17:39) are being changed by direct input then you can use the below script.
If the values are changing due to formula values changing then my knowledgebase has no answer for you. It turns into a on calculation event that then gets complicated for me.
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("D17:D39")) Is Nothing Then
If Target.Value = "0" Then Rows(Target.Row).Hidden = True Else Rows(Target.Row).Hidden = False