I've been struggling to try and get anything to work and hoping someone might have an idea.

If C5 has a value I Need Rows 6, 106 and 107 to become visible. I then need it to check if C6 has a value and if so make the next row visible and so on until it reaches row 106.

This will all be run under a Private Sub Worksheet_Change(ByVal Target as Range).

I hope this makes sense any help would be greatly appreciated.



  • so if the cell in column c gets a value unhide the row beneath it? – Scott Craner Jul 12 '18 at 14:06

This will unhide the three rows on C5 changing, then unhide the next row as C changes:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("C5"), Target) Is Nothing Then
    Rows(6).Hidden = Target.Value = ""
    Rows("106:107").Hidden = Target.Value = ""

End If
If Not Intersect(Range("C6:C105"), Target) Is Nothing Then
    Rows(Target.Row + 1).Hidden = Target.Value = ""
End If

End Sub
  • Thanks, i've tried this but nothing happens? – Drew Jul 12 '18 at 14:18
  • are your rows already hidden? Did you put the code in the worksheet code sheet? This does not hide the rows but assumes that the rows are already hidden. – Scott Craner Jul 12 '18 at 14:23
  • Thanks, stupid moment had put it under the wrong sheet. secondary question how can i make it if the cell is blank that it hides the row? – Drew Jul 12 '18 at 14:26
  • so if they delete the value it hides the row underneath, or do you want to iterate the column hiding all the rows that do not have a value? – Scott Craner Jul 12 '18 at 14:28
  • yes so if c6 is blank then hide row 7. also if c5 is blank hide rows 6, 106 and 107. – Drew Jul 12 '18 at 14:30

Your Answer

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.