Cell link via macro?

  • Thread starter Thread starter Dori
  • Start date Start date
D

Dori

Hi,
I´d like to get the value of item, selected in the list, but I have not
filled in the "Cell link". Have anyone any idea, how to get the value from
macro, without filling "Cell link"? I know the name of the element, but it
has no properties like Value or Text...
Thanks for any advice....
 
If it is a data validation list then just read the cell where the list is
located

MyValue = Range("A1")
 
Thanks, but the list is not located in any cell. I have list (?drop down box)
which items are defined by cells range ("Input Range" in the format control).
Does anybody know?

Joel píše:
 
This code should help. The LISTINDEX starts at 0 for first item in the list
box

Sub test()

ActiveSheet.ListBox1.Clear
ActiveSheet.ListBox1.AddItem "abc"
ActiveSheet.ListBox1.AddItem "def"
ActiveSheet.ListBox1.ListIndex = 1

SelectedItem = ActiveSheet.ListBox1.ListIndex


End Sub
 

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