Hello,
I'm trying to build a spreadsheet that has static cells on rows 3 - 2,862, the vast majority of which are initially hidden. As values are added to column C on the rows that aren't hidden, additional rows will unhide. For example, row 14 is shown while rows 15 - 62 are hidden. If C14 has a value, row 15 automatically unhides. If C15 has a value, row 16 automatically unhides, so on and so forth. I do this same type of function with differing patterns hundreds of times and it results in ~200,000 lines of VBA code, but the Sub I'm using maxes out around 60,000. Is there a more efficient way to do this same function? I've included my current code below, and attached a dummy spreadsheet.
I'm trying to build a spreadsheet that has static cells on rows 3 - 2,862, the vast majority of which are initially hidden. As values are added to column C on the rows that aren't hidden, additional rows will unhide. For example, row 14 is shown while rows 15 - 62 are hidden. If C14 has a value, row 15 automatically unhides. If C15 has a value, row 16 automatically unhides, so on and so forth. I do this same type of function with differing patterns hundreds of times and it results in ~200,000 lines of VBA code, but the Sub I'm using maxes out around 60,000. Is there a more efficient way to do this same function? I've included my current code below, and attached a dummy spreadsheet.
Code:
If Target.Address(False, False) = "C14" Then
Select Case Target.Value
Case "": Rows("15:15").Hidden = True
Case Is <> "": Rows("15:15").Hidden = False
Range("C15").Select
End Select
End If
If Target.Address(False, False) = "C15" Then
Select Case Target.Value
Case "": Rows("16:16").Hidden = True
Case Is <> "": Rows("16:16").Hidden = False
Range("C16").Select
End Select
End If
If Target.Address(False, False) = "C16" Then
Select Case Target.Value
Case "": Rows("17:17").Hidden = True
Case Is <> "": Rows("17:17").Hidden = False
Range("C17").Select
End Select
End If