我的 VBA 代码在基于选定案例加载具有不同列表的组合框时成功运行。但是,当我从下拉列表中选择一个选项时,选择不会加载到组合框中。组合框变为空白。
这是我的 VBA 代码:
Private Sub cbxTrainingSubject_DropButtonClick()
cbxTrainingSubject.Clear
Set shTables = ThisWorkbook.Sheets("Tables")
Set shForm = ThisWorkbook.Sheets("Form")
Dim rng As Range
Select Case cbxTrainingArea.Value
Case "Assembly"
Set rng = shTables.ListObjects("assemblyTraining").ListColumns("Assembly Training").DataBodyRange
shForm.cbxTrainingSubject.List = Application.Transpose(rng.Value)
Case "Fabrication"
Set rng = shTables.ListObjects("FabTraining").ListColumns("Fab Training").DataBodyRange
shForm.cbxTrainingSubject.List = Application.Transpose(rng.Value)
End Select
End Sub
当我进行选择时,组合框保持空白。