E
Eric
Hello,
Let me start by saying, I have years of excel experience, but very little
VBA experience.
I currently have a data validation list with 8 options. My goal is to have
the user select an option, then have a section expand just below that, based
on what they select.
I have attempted to write a macro to do this, but failed miserably. (I
decided to start with the first 2 options until I could get those to work) I
don't know if this is even close, but this is what I have started:
Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Range("vUtility_Company").Value
Case ""
PS_MinimizeALL
Case "PGE Residential"
PGE_Res
Case "PGE Business"
PGE_Bus
Case Else
Exit Sub
End Select
End Sub
Sub PS_MinimizeALL()
If [vUtility_Company] = "" Then
Rows("31:63").Select
Selection.EntireRow.Hidden = True
End If
End Sub
Sub PGE_Res()
If [vUtility_Company] = "PGE Residential" Then
Rows("31:63").Select
Selection.EntireRow.Hidden = False
ElseIf [vUtility_Company] <> "PGE Residential" Then
Rows("30:64").Select
Selection.EntireRow.Hidden = True
End If
End Sub
Sub PGE_Bus()
If [vUtility_Company] = "PGE Business" Then
Rows("31:63").Select
Selection.EntireRow.Hidden = True
ElseIf [vUtility_Company] <> "PGE Business" Then
Rows("30:64").Select
Selection.EntireRow.Hidden = False
End If
End Sub
Let me start by saying, I have years of excel experience, but very little
VBA experience.
I currently have a data validation list with 8 options. My goal is to have
the user select an option, then have a section expand just below that, based
on what they select.
I have attempted to write a macro to do this, but failed miserably. (I
decided to start with the first 2 options until I could get those to work) I
don't know if this is even close, but this is what I have started:
Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Range("vUtility_Company").Value
Case ""
PS_MinimizeALL
Case "PGE Residential"
PGE_Res
Case "PGE Business"
PGE_Bus
Case Else
Exit Sub
End Select
End Sub
Sub PS_MinimizeALL()
If [vUtility_Company] = "" Then
Rows("31:63").Select
Selection.EntireRow.Hidden = True
End If
End Sub
Sub PGE_Res()
If [vUtility_Company] = "PGE Residential" Then
Rows("31:63").Select
Selection.EntireRow.Hidden = False
ElseIf [vUtility_Company] <> "PGE Residential" Then
Rows("30:64").Select
Selection.EntireRow.Hidden = True
End If
End Sub
Sub PGE_Bus()
If [vUtility_Company] = "PGE Business" Then
Rows("31:63").Select
Selection.EntireRow.Hidden = True
ElseIf [vUtility_Company] <> "PGE Business" Then
Rows("30:64").Select
Selection.EntireRow.Hidden = False
End If
End Sub