Select name in dropdown

Ramachandran

New Member
Joined
Oct 17, 2011
Messages
47
If I want to get the (string) value of the select item in the dropdown, that's allright:
With Worksheets("Registrering").Shapes("Drop Down 1").ControlFormat
name = .List(.Value)
End With

But I want to go the other way, selecting the listindex from the string value,
If I do this:

With Worksheets("Registrering").Shapes("Drop Down 1").ControlFormat
.List(.Value) = namn
End With
I will overwrite listindex = 1...
 

Some videos you may like

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Ramachandran

New Member
Joined
Oct 17, 2011
Messages
47
If I run the last code, the drop down(Forms Combobox) will show the name.value, but it will overwrite whatever the previous selected value was.
The name.value is already added to the dropdown, I simply want to programmatically select it.
Anyone who can help?
 

Ramachandran

New Member
Joined
Oct 17, 2011
Messages
47
With Worksheets("Registrering").Shapes("Drop Down 1").ControlFormat
i = 0
Do
i = i + 1
Loop Until .List(i) = name Or i = .ListCount
.ListIndex = i
End With

This works, so I'm happy. But please do let me know if there is any other solution.
 

Kyle123

Well-known Member
Joined
Jan 24, 2012
Messages
2,711
like this:
Code:
With Worksheets("Registrering").DropDowns("drop down 1")   
    .Value = Application.Match(name, .List, 0)
End With
 

Watch MrExcel Video

Forum statistics

Threads
1,127,099
Messages
5,622,700
Members
415,922
Latest member
gemmatay88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top