Link to home
Create AccountLog in
Avatar of FaheemAhmadGul
FaheemAhmadGulFlag for United Kingdom of Great Britain and Northern Ireland

asked on

VBA ListBox - get the value of the selected item and dislay it in a message box

I am displaying a few strings items on ListBox on a Form. I would like to display the value of the item (which is a string) displayed in a message box when I click on it. I would appreciate your help.
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of FaheemAhmadGul

ASKER

Thank you for your comment. This does not work, however. We need the value of the selected item and not of the ListBox - that is we want to display the value of the item on which the user clicks. This will involve finding out which item the user clicked on and then fidning its value.
Avatar of Norie
Norie

That code should show you the item that's been clicked in the listbox because Value returns the value of the selected item in the listbox.
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Many thanks. Actually both the solutions work. I have split the points - more points to Norie because that solution was post first. Hope this OK.