将combobox下拉列表值添加到新行

嗨,我知道这听起来可能听起来很容易,但因为我是新的VBA,因此我需要一些帮助,在调整用户窗体vba代码下面的combobox下拉列表值插入新行。 目前我有一个添加命令button,将所有input的用户窗体添加到find的新行。 我现在面临的当前问题是我需要在add命令button中为comboBox行“.Text”进行调整,以使其顺利运行。 下面的代码,我已经和我现在面临的问题,我已经评论了线。

Private Sub CommandAddButton1_Click() Dim sh As Worksheet: Set sh = ThisWorkbook.Sheets("Program Status Summary") Dim emptyRow As Integer: emptyRow = 1 + sh.UsedRange.Find(ComboBoxProjSizes.Text).End(xlDown).Row With sh .Cells(emptyRow, "A").Value = 1 + Application.Max(.Columns(1)) ' to generate a new identifier in column 1 .Cells(emptyRow, "B").Value = TextBoxProjCode.Text .Cells(emptyRow, "C").Value = TextBoxProjName.Text .Cells(emptyRow, "D").Value = TextBoxSector.Text .Cells(emptyRow, "E").Value = TextBoxObjective.Text .Cells(emptyRow, "H").Value = TextBoxProjSponsor.Text .Cells(emptyRow, "G").Value = TextBoxProjSponsorNew.Text .Cells(emptyRow, "F").Value = TextBoxProjM.Text .Cells(emptyRow, "T").Value = TextBoxRegulatory.Text .Cells(emptyRow, "N").Value = TextBoxRiskLvl.Text .Cells(emptyRow, "M").Value = TextBoxDatePar.Text .Cells(emptyRow, "J").Value = TextBoxCostPar.Text .Cells(emptyRow, "O").Value = TextBoxAffectCust.Text .Cells(emptyRow, "Q").Value = TextBoxCustNonRetail.Text .Cells(emptyRow, "P").Value = TextBoxCustRetail.Text .Cells(emptyRow, "S").Value = TextBoxOutsourcingImp.Text .Cells(emptyRow, "R").Value = TextBoxKeyStatus.Text .Cells(emptyRow, "K").Value = TextBoxSchStart.Text .Cells(emptyRow, "L").Value = TextBoxSchEnd.Text .Cells(emptyRow, "V").Value = ComboBoxRagSchedule.Text 'Not Sure what to change the word ".Text" to so that the value in the comboBox would appear in the cell' .Cells(emptyRow, "U").Value = ComboBoxRagFinancial.Text'Not sure what to change the word ".Text" to so that the value in the comboBox would appear in the cell' .Cells(emptyRow, "W").Value = ComboBoxRagBenefit.Text'Not sure what to change the word ".Text" to so that the value in the comboBox would appear in the cells ) .Cells(emptyRow, "I").Value = TextBoxCost.Text .Rows(emptyRow + 1).Insert End With Unload AddProject End Sub 

任何帮助深表感谢。 谢谢 :)

尝试.Value而不是.Text ,应该在运行macros之后将当前选定的值插入到单元格中。 你可以在这里阅读更多。