dropdown value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,

i would like to know how i can display the value of a dropdown box in a
messagebox. does anyone know how i can do this?
thanks in advance,
geebee
 
First find what your RowSource is, once you know,
in your code you do something like this
p = UserForm1.ComboBox1.Value
MsgBox (p)
 
hi,

this will not work. the combobox is not in a userform. it is in a sheet of
the workbook. would there be different code?
thanks in advance,
geebee
 
There are two type of combo boxes, on under the Forms Menu and one under the
visual basic menu.
The first one will allow you to right click on it and you can select format
control from the menu this will bring a window with 5 tabs one of them named
control, in there you will see the the cell link say for example A1, and the
input range $A$2:$A$10

Then type this on your code:

i = Range("A1").Value
p = Cells(1, 1).Offset(i, 0) ' The 1st number is your row, and the 2nd is
your column
MsgBox (p)

For the second type of combo box, you must first click on the design icon,
so it will allow you to select the object by righ clicking on it; once the
menu shows, select properties and click on the categorized tab, look under
the misc category and where it says linkedcell you will see a cell reference
for example C5, place the code below:
p = Range("C5").value

MsgBox (p)

This should work, unless is not a real dropdown but a data validation cell.

--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top