ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   DropDowns and item values (https://www.excelbanter.com/excel-programming/373370-dropdowns-item-values.html)

[email protected]

DropDowns and item values
 
Suppose I create a dropdown as following:

Set drp = ActiveWorkbook.Sheets("Sheet1").DropDowns("GroupBy ")
drp.RemoveAllItems
drp.AddItem "Group By", 232
drp.AddItem "Resource", 100
drp.AddItem "Project", 400
drp.ListIndex = 1
end Sub

If the DropDown has Project selected how do I get 400?

These return 3:

MsgBox drp.Value
MsgBox drp.ListIndex

Thanks


Tom Ogilvy

DropDowns and item values
 
the values are not stored in the list. You would need to store them
somewhere or hard code them and figure out what the value is based on the
listindex property.

--
Regards,
Tom Ogilvy

wrote in message
ups.com...
Suppose I create a dropdown as following:

Set drp = ActiveWorkbook.Sheets("Sheet1").DropDowns("GroupBy ")
drp.RemoveAllItems
drp.AddItem "Group By", 232
drp.AddItem "Resource", 100
drp.AddItem "Project", 400
drp.ListIndex = 1
end Sub

If the DropDown has Project selected how do I get 400?

These return 3:

MsgBox drp.Value
MsgBox drp.ListIndex

Thanks




[email protected]

DropDowns and item values
 
This worked:

drp.List(drp.ListIndex)


Tom Ogilvy

DropDowns and item values
 
Not for me, not with the code you showed.

that would produce "Project", not 400.

--
Regards,
Tom Ogilvy



wrote in message
ups.com...
This worked:

drp.List(drp.ListIndex)




[email protected]

DropDowns and item values
 
Right.

My bad.

Thanks Tom.

Tom Ogilvy wrote:
Not for me, not with the code you showed.

that would produce "Project", not 400.




All times are GMT +1. The time now is 10:33 AM.

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