【发布时间】:2020-06-07 00:18:37
【问题描述】:
如何使用 VBA 在组合框中插入命名范围 这里根据combobox1中的值,我需要在combobox2中插入某些命名范围。 这里 Def1m、Def2m 等是命名范围
Private Sub Def_Change()
If combobox1.Value = "1 month" Then
Me.combobox2.RowSource = Def1m
ElseIf combobox1.Value = "2 month" Then
Me.combobox2.RowSource = Def2m
ElseIf combobox1.Value = "3 month" Then
Me.combobox2.RowSource = Def3m
ElseIf combobox1.Value = "6 month" Then
Me.combobox2.RowSource = Def6m
ElseIf combobox1.Value = "yearly" Then
Me.combobox2.RowSource = Defyearly
End If
End Sub
请推荐
【问题讨论】:
-
Def1m 是变量还是命名范围的名称?如果是字符串,则放入“”,例如"Def1m"