I have a spreadsheet for creating a quote with a number of dropdown choices. Once the dropdown choice is made, a number of the rows are hidden by using the following formula: Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Me.Range("C18")) Is Nothing Then Exit Sub
Application.EnableEvents = False 'to prevent endless loop
Rows("1:2000").EntireRow.Hidden = False
If Range("$C$18").Value = "G3LabUniversalDV" Then
Range("63:122").EntireRow.Hidden = True
Range("195:396").EntireRow.Hidden = True
Range("1249:1265").EntireRow.Hidden = True
Range("1301:1302").EntireRow.Hidden = True
End If
If Range("$C$18").Value = "G3LabUniversalPC" Then
Range("123:396").EntireRow.Hidden = True
Range("1071:1248").EntireRow.Hidden = True
Range("1296:1300").EntireRow.Hidden = True
End If
If Range("$C$18").Value = "G3ProUniversal" Then
Range("63:194").EntireRow.Hidden = True
Range("272:359").EntireRow.Hidden = True
Range("1249:1265").EntireRow.Hidden = True
Range("1301:1302").EntireRow.Hidden = True
End If
If Range("$C$18").Value = "G3PC" Then
Range("63:271").EntireRow.Hidden = True
Range("1071:1248").EntireRow.Hidden = True
Range("1296:1300").EntireRow.Hidden = True
End If
Application.EnableEvents = True
End Sub
What I am having a problem with is when I add a Row to the Spreadsheet, these sections are not automatically updated and I have to go back and enter in all the new ranges by hand. Is there an easier way to do this? In addition to this, am I able to use and formula name for the range and just change the formula when a row is entered? Please help!
If Intersect(Target, Me.Range("C18")) Is Nothing Then Exit Sub
Application.EnableEvents = False 'to prevent endless loop
Rows("1:2000").EntireRow.Hidden = False
If Range("$C$18").Value = "G3LabUniversalDV" Then
Range("63:122").EntireRow.Hidden = True
Range("195:396").EntireRow.Hidden = True
Range("1249:1265").EntireRow.Hidden = True
Range("1301:1302").EntireRow.Hidden = True
End If
If Range("$C$18").Value = "G3LabUniversalPC" Then
Range("123:396").EntireRow.Hidden = True
Range("1071:1248").EntireRow.Hidden = True
Range("1296:1300").EntireRow.Hidden = True
End If
If Range("$C$18").Value = "G3ProUniversal" Then
Range("63:194").EntireRow.Hidden = True
Range("272:359").EntireRow.Hidden = True
Range("1249:1265").EntireRow.Hidden = True
Range("1301:1302").EntireRow.Hidden = True
End If
If Range("$C$18").Value = "G3PC" Then
Range("63:271").EntireRow.Hidden = True
Range("1071:1248").EntireRow.Hidden = True
Range("1296:1300").EntireRow.Hidden = True
End If
Application.EnableEvents = True
End Sub
What I am having a problem with is when I add a Row to the Spreadsheet, these sections are not automatically updated and I have to go back and enter in all the new ranges by hand. Is there an easier way to do this? In addition to this, am I able to use and formula name for the range and just change the formula when a row is entered? Please help!