How do i get the selected value of the combobox?
i have a combobox which has the values: "Corporate" and "Consumer".
I want to get the value that i selected, not the index, and store in a string.
something like this:
string a = combobox.value;
(a -> Consumer)
thank you
Value
has a capital "V" in VBA, but assumingcombobox
is the name of the ComboBox you created on the screen, the code you have will work (except that your assignment statement is wrong; see below). If you don't know what the name of the ComboBox is, it is likelyComboBox1
. To check, look at theName
property in the VBA properties window.Try this:
If your ComboBox is embedded in a spreadsheet you can use this:
Or in one line: