Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
How do I remove empty rows at the end of the second drop-down menu when selecting "steel" in the first drop-down menu?
Solved! Go to Solution.
You could use "ReDim" to redimension variable "Section".
Sub ComboBoxEvent_Start()
Material= Worksheet.GetValue("Material")
If Material= "Cast Iron" Then
Dim Section(2)
Section(0) = "1"
Section(1) = "2"
Section(2) = "3"
ElseIf Material= "Steel" Then
ReDim Section(2)
Section(0) = "A"
Section(1) = "B"
Section(2) = "C"
Else
ReDim Section(4)
Section(0) = "A1"
Section(1) = "B2"
Section(2) = "C3"
Section(3) = "D3"
Section(4) = "E3"
End If
ComboBox.List() = Section
End Sub
You could use "ReDim" to redimension variable "Section".
Sub ComboBoxEvent_Start()
Material= Worksheet.GetValue("Material")
If Material= "Cast Iron" Then
Dim Section(2)
Section(0) = "1"
Section(1) = "2"
Section(2) = "3"
ElseIf Material= "Steel" Then
ReDim Section(2)
Section(0) = "A"
Section(1) = "B"
Section(2) = "C"
Else
ReDim Section(4)
Section(0) = "A1"
Section(1) = "B2"
Section(2) = "C3"
Section(3) = "D3"
Section(4) = "E3"
End If
ComboBox.List() = Section
End Sub
Thank you very much!
Is it possible to implement the same solution so that the row names in the second menu are defined not in the menu code, but in an array on the MathCAD file, designated by a variable above the menu itself. This way, each row name is assigned a corresponding value, also defined in an array like the row names?
That's sure possible to implement.
You might be interested in Richards collection of components here -> Extra Components and Controls - PTC Community
Especially the section "Dynamically filled list boxes" in the last third of the sheet.
I am not sure if it will be of use to you but I also attached an old quite elaborate file from Tom Gutman which may be of interest. It feeds the boxes from Excel files. i have not tested if his solution still works in MC14/15. Maybe its necessary to resave the Excel files in xlsx format?
