M
mtm4300 via OfficeKB.com
I have two comboxes in my worksheet. The first has 3 selections and each
selection changes the data in the second combobox, which has 7 selections.
Each of the 7 selections will change text within cells. I have the second
combobox setup to change by selecting a case of the first one. Now I need to
change the cells by using second combobox and I am trying to use the Select
Case function. I sit possible to have 'subcases?' Here is an example of the
code I have:
Sub CreateMethodE()
' Creates the three different methods in the English measurement System.
Dim idex As Long
Dim newname As Worksheet
Set newname = Sheets("Program")
On Error Resume Next
Worksheets(1).DropDowns("MethodE").Delete
On Error GoTo 0
On Error Resume Next
Worksheets(1).DropDowns("typeE").Delete
On Error GoTo 0
With Worksheets(1).Shapes.AddFormControl(xlDropDown, _
Left:=245, Top:=189.75, Width:=192, Height:=15)
.ControlFormat.DropDownLines = 3
.ControlFormat.AddItem "E1: Mainline or Public Road Approach", 1
.ControlFormat.AddItem "E2: Drive, Including Class V", 2
.ControlFormat.AddItem "E3: Median/Mainline or Public Road Approach*", 3
.Name = "MethodE"
.OnAction = "MethodE_Change"
End With
End Sub
___________________
Sub MethodE_Change()
Dim idex As Long
Dim newname As Worksheet
Set newname = Sheets("Program")
On Error Resume Next
Worksheets(1).DropDowns("typeE").Delete
On Error GoTo 0
idex = Worksheets(1).DropDowns("MethodE").ListIndex
With Worksheets(1).Shapes.AddFormControl(xlDropDown, _
Left:=245, Top:=309, Width:=192, Height:=15)
.ControlFormat.DropDownLines = 7
.Name = "typeE"
Select Case idex
Case 1
.ControlFormat.AddItem "E1: Circular Corrugated Pipe", 1
.ControlFormat.AddItem "E1: Circular Corrugated Pipe (SPM)", 2
.ControlFormat.AddItem "E1: Circular Smooth-Interior Pipe", 3
.ControlFormat.AddItem "E1: Deformed Corrugated Pipe", 4
.ControlFormat.AddItem "E1: Deformed Corrugated Pipe (SPAA)", 5
.ControlFormat.AddItem "E1: Deformed Corrugated PIpe (SPS)", 6
.ControlFormat.AddItem "E1: Deformed Smooth-Interior Pipe", 7
.OnAction = "E1Pipe1_Change"
I have 2 more cases, but they will be the same as this one. I have a
subroutine called "E1Pipe!_Change" but I dont know what to put in there to
change the cells each time a user clicks on a different option. Any help
would be greatly appreciated!
selection changes the data in the second combobox, which has 7 selections.
Each of the 7 selections will change text within cells. I have the second
combobox setup to change by selecting a case of the first one. Now I need to
change the cells by using second combobox and I am trying to use the Select
Case function. I sit possible to have 'subcases?' Here is an example of the
code I have:
Sub CreateMethodE()
' Creates the three different methods in the English measurement System.
Dim idex As Long
Dim newname As Worksheet
Set newname = Sheets("Program")
On Error Resume Next
Worksheets(1).DropDowns("MethodE").Delete
On Error GoTo 0
On Error Resume Next
Worksheets(1).DropDowns("typeE").Delete
On Error GoTo 0
With Worksheets(1).Shapes.AddFormControl(xlDropDown, _
Left:=245, Top:=189.75, Width:=192, Height:=15)
.ControlFormat.DropDownLines = 3
.ControlFormat.AddItem "E1: Mainline or Public Road Approach", 1
.ControlFormat.AddItem "E2: Drive, Including Class V", 2
.ControlFormat.AddItem "E3: Median/Mainline or Public Road Approach*", 3
.Name = "MethodE"
.OnAction = "MethodE_Change"
End With
End Sub
___________________
Sub MethodE_Change()
Dim idex As Long
Dim newname As Worksheet
Set newname = Sheets("Program")
On Error Resume Next
Worksheets(1).DropDowns("typeE").Delete
On Error GoTo 0
idex = Worksheets(1).DropDowns("MethodE").ListIndex
With Worksheets(1).Shapes.AddFormControl(xlDropDown, _
Left:=245, Top:=309, Width:=192, Height:=15)
.ControlFormat.DropDownLines = 7
.Name = "typeE"
Select Case idex
Case 1
.ControlFormat.AddItem "E1: Circular Corrugated Pipe", 1
.ControlFormat.AddItem "E1: Circular Corrugated Pipe (SPM)", 2
.ControlFormat.AddItem "E1: Circular Smooth-Interior Pipe", 3
.ControlFormat.AddItem "E1: Deformed Corrugated Pipe", 4
.ControlFormat.AddItem "E1: Deformed Corrugated Pipe (SPAA)", 5
.ControlFormat.AddItem "E1: Deformed Corrugated PIpe (SPS)", 6
.ControlFormat.AddItem "E1: Deformed Smooth-Interior Pipe", 7
.OnAction = "E1Pipe1_Change"
I have 2 more cases, but they will be the same as this one. I have a
subroutine called "E1Pipe!_Change" but I dont know what to put in there to
change the cells each time a user clicks on a different option. Any help
would be greatly appreciated!