【发布时间】:2015-06-09 03:40:14
【问题描述】:
我正在做一个项目,我有一个 userform 和多个 comboboxes。 comboboxes 将输出到我指定的单元格。我的问题是我想要一个button,它根据combobox 输出对项目进行排名。我希望用户能够更改combobox 输入,单击排名button 并按顺序更改相应的列表。正如您在下面看到的,我使用了“Cells(3, 2).Value = C02Combo.Value”。我知道这只会输出到第 3 行,但我需要用户表单输出到我选择打开用户表单的任何行(列可以保持不变)。我在下面的 cmets 中尝试了一些“emptyrow”变量,但没有运气。我是 VBA 初学者,如果问题解释不正确,请见谅。
私有子 enterData_Click()
'Dim emptyRow As Long
'Make Sheet1 active
'Model.Activate
'Determine emptyRow
'emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1
'Code to write form data to spreadsheet here
Cells(3, 2).Value = C02Combo.Value
Cells(3, 3).Value = AdminCombo.Value
Cells(3, 4).Value = FacultyCombo.Value
Cells(3, 5).Value = ResearchCombo.Value
Cells(3, 6).Value = EducationCombo.Value
Cells(3, 7).Value = CommunityCombo.Value
Cells(3, 8).Value = InnovationCombo.Value
Cells(3, 9).Value = CostCombo.Value
Cells(3, 10).Value = PaybackCombo.Value
Cells(3, 11).Value = CostPerCutCombo.Value
Unload Me
结束子
【问题讨论】:
标签: vba excel dynamic combobox userform