1

I want to set up for Excel Macro to automatically hide/unhide entire row based on the values in Column D.

e.g. If the value in D3 = 0, then hide If the value in D4 = 1, then unhide

Only variables are 0 and 1 to indicate whether the row needs to be hidden.

Thank you!

New contributor
R P is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
1

Try this, it goes in the code for the worksheet, not a module.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$D$3" And Target.Value = 0 Then
Rows(7).Hidden = True
End If
If Target.Address = "$D$4" And Target.Value = 1 Then
Rows(7).Hidden = False
End If
End Sub
New contributor
Justin Doward is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

R P is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.