ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cell link via macro? (https://www.excelbanter.com/excel-programming/409061-cell-link-via-macro.html)

DORI

Cell link via macro?
 
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....


joel

Cell link via macro?
 
If it is a data validation list then just read the cell where the list is
located

MyValue = Range("A1")

"Dori" wrote:

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....


DORI

Cell link via macro?
 
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:

If it is a data validation list then just read the cell where the list is
located

MyValue = Range("A1")

"Dori" wrote:

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....


joel

Cell link via macro?
 
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


"Dori" wrote:

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:

If it is a data validation list then just read the cell where the list is
located

MyValue = Range("A1")

"Dori" wrote:

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....



All times are GMT +1. The time now is 06:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com