Tag: combobox

如何向Excel 2010中的一列中的每个单元添加是/否combobox

看标题。 我怎样才能在Excel 2010中做到这一点?

使用VBA,如何基于excel表中特定的comlumn填充ComboBox值

使用VBA,我试图build立这个复杂的forms来添加新的行到现有的表。 我想要这个ComboBox将列出已经存在于表格列中的值。 我是VBA新手。 我尝试了一些范围/select和sorting组合,目前为止不乏…

从combobox(VB.NET)打开Excel工作簿

如何从combobox打开Excel工作簿? 我正在使用下面的代码来填充excel文件名combobox, Dim files() As String files = Directory.GetFiles("C:\Files\Folder", "*.xlsx", SearchOption.AllDirectories) For Each FileName As String In files ComboBox1.Items.Add(FileName.Substring(FileName.LastIndexOf("\") + 1, FileName.Length – FileName.LastIndexOf("\") – 1)) Next 但我不知道如何打开选定的文件。

如何正确引用Excelcombobox的源代码的dynamic列表?

我的用户表单上有两个combobox。 第一个提供了来自命名列表“类别”的选项。 我在这个combobox的行源中input了“类别”这个单词,它能正常提供“类别”列表中所有项目的下拉菜单。 类别列表中的每个项目本身都是一个命名范围。 我想第二个combobox(供应商)读取在第一个选定的项目,然后提供选定的命名范围内的选项。 目前它只提供每个指定范围内的第一个项目。 我目前使用下面的代码为第一个combobox。 Private Sub Category_Change() Worksheets("Input").Range("D10") = Category.Value 'Worksheets("Input").Range("D10") = CStr(Worksheets("Input").Range("D10")) Supplier.RowSource = Worksheets("Input").Range("D10") End Sub 这将为第一个comboboxselect的值写入单元格,然后尝试获取第二个combobox来读取此… 任何帮助将是macros伟的! 玩笑

无法使用JXL API在Excel中查看ComboBox

我试图用JXL API在以下代码中显示ComboBox: ArrayList<String> arrList = new ArrayList<String>(); arrList.add("DropDown1"); arrList.add("DropDown2"); arrList.add("DropDown3"); WritableCellFeatures cellFeatures = new WritableCellFeatures(); cellFeatures.setDataValidationList(arrList); Blank b = null; Label checkLabel = null; for (int x = 0; x < xlData.size(); x++) { for (int i = 0; i <= 14; i++) { System.out.println("X:" + x + "I:" + i); if (i > 9) […]

combobox只显示一条logging

我有一个Excel VBA中的combobox,它只显示一个logging,但它应该显示7.我已经debuged的代码,我可以看到程序如何通过代码分配列表中的所有条目,但只有一个显示。 有人能告诉我我错过了什么吗? SqlSelect = "SELECT distinct [country] FROM [Data]" 'there are 7 records returned in this query Set AdoRst = New ADODB.Recordset AdoRst.Open SqlSelect, WfmDbCn, adOpenForwardOnly, adLockReadOnly, adCmdText With Me.cmbCountry .ColumnCount = 1 .ColumnWidths = "0;0;150" .BoundColumn = 1 Do Until .ListCount = 0 .RemoveItem (0) Loop i = 0 Do While Not AdoRst.EOF […]

根据更改Combobox值设置单元格查找值

我在Excel工作表中input了一个combobox 。 我希望它能够工作,以便无权访问VBA用户可以从dropdownselect一个值,然后另一个单元格中的值将对此值执行vlookup 。 在第一个例子中,我插入了一个框,并试图设置一个基于此的单元格值。 Sub InsertComboBox() #inserts dropdown box on the front page and sets the values as the list of DMA from the pipe_totals sheet #this should be the most complete list so will not change dependant on asset Dim arearange As Range Set arearange = Sheets("pipe_totals").Range("a:a") lastrowi = Application.WorksheetFunction.CountA(arearange) Sheets("front page").Activate With […]

使用Excel 2013 vba访问多个工作表

我有3个工作表,我有数据。主工作表有一个名为Lists ,包含combobox的各种列表工作表。 我试图使列表dynamic,即有能力添加条目,并让他们显示下一次用户转到用户窗体上的combobox。 我有这个代码,只要我在正确的工作簿的Lists表,这工作正常: ThisWorkbook.sheets("Lists").Range("I1", Range("I" & Rows.Count).End(xlUp)).Name = "DriverList" 但是,如果我在另一个工作表或另一个工作簿(都在同一个目录中),我得到一个 运行时错误#1004。 我已经尝试了以下两条线,但都没有成功: dim spath, sfile as string dim wbCharityBins as Workbook spath = "Z:\Charity Bins 2015 Test Data\" sfile = "Charity Bins 2015 – test.xlsm" Set wbCharityBins = Workbooks.(spath & sfile) wbCharityBins.sheets("lists")… etc 要么 Workbooks(spath & "Charity Bins 2015 – test.xlsm").sheets("Lists").Select 这两个尝试给: 下标超出范围,错误9 我有一个初始化例程,打开所有的工作簿之前,我遇到了上述问题,所以工作簿是开放的。 […]

当range.cells.count = 1时,combobox列表

当范围只有一个单元格时,我很难从一个范围内填充一个combobox。 我有以下代码: Private Sub cboEquip_Change() Dim SourceData As Variant Dim col As Variant Dim rng As Range Set ws = Sheets("Details") On Error Resume Next 'Matches text from cboEquip to appropriate column in Details sheet col = WorksheetFunction.Match(Me.cboEquip.Value, ws.Range("1:1"), 0) 'Sets number of items in list lr = ws.Cells(ws.Rows.Count, col).End(xlUp).Row 'Chooses correct range Set rng […]

复制一个combobox项目列表,而不影响当前写在combobox内的内容?

如何重新填充combobox项目列表,而不影响当前写在combobox内的内容? 我目前有代码,看起来有点像: Private Sub ComboBox1_DropButtonClick() Dim v As Variant Dim selText As String selText = ComboBox1.selText Dim i As Integer For i = 0 To ComboBox1.ListCount – 1 ComboBox1.RemoveItem (0) Next i v = Call CreateList() For i = 0 to Ubound(v) ComboBox1.AddItem v(i) Next v If selText <> "" Then ComboBox1.Text = selText End […]