get values from combobox in excel.

R

roshinpp_77

Hi members,
I am not able to get the values corresponding to selection made i
combo box in excel sheet.

In macro , i am not able to retrieve corresponding values of combo bo
selection.

for eg:
Sub DropDown1_Click()
Select Case DropDown1.Value
Case 0 'Left Top
MsgBox "Left Top"

Case 1 'Left Center
MsgBox "Left Center"

Case 2 'Left Bottom
MsgBox "Left Bottom"

Case 3 'Right Top
MsgBox "Right Top"
End Select

End Sub

Here my doubt is how to identify the name of the combobox in excel.
After identifying the mname , how to retrieve values of eac
selection.

DropDown1.Value is not working!!

pls help..

Roshi
 
D

Dave Peterson

I assigned this macro to any/all of the dropdowns from the Forms toolbar and it
seemed to work ok:

Option Explicit
Sub testme()

Dim myDD As DropDown
Set myDD = ActiveSheet.DropDowns(Application.Caller)

With myDD
If .ListIndex > 0 Then
MsgBox .List(.ListIndex)
End If
End With

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

Top