从2列ComboBox VBA中检索两个值 [英] Retrieving both values from a 2 column ComboBox VBA
本文介绍了从2列ComboBox VBA中检索两个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个用户表单(excel,VBA),其中有一个2列组合框.当用户从组合框中选择某个值时,我想获取他选择的值以及与第一个值(即第二个列值)关联的值.
I have a user form (excel, VBA) where there is a 2 column combobox. When user selects a certain value from the combobox, I want to get the value he selected, and the value associated with the first value (ie. the second column value).
我该怎么做?只需ComboBox1.Value
返回第一列的值. ComboBox1.Value(0)
不起作用.
How do I do this? Simply ComboBox1.Value
returns the value of the first column. ComboBox1.Value(0)
doesn't work.
推荐答案
使用组合框的column属性.它基于0,因此第一列为column(0),第二列为column(1).
Use the column property of the combobox. It is 0-based so the first column is column(0) and the second column is column(1).
Me.ComboBox1.Column(1)
这篇关于从2列ComboBox VBA中检索两个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文