Build a dropdown on the fly

JoeMajestee

New Member
Joined
Jul 15, 2009
Messages
49
In my VBA, I often search for an expected value in row 1 of a worksheet. If I find more or less than expected, I would like to present the user with a dropdown containing what is in those rows so they can pick one. Is there a generic way to do this without creating a userform?

I like the idea of generic because the amount of data changes from worksheet to worksheet.

Thanks!
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
When you click a cell and use the right mouse button you get the Pick from List option which is a drop down showing what is available.

Have you considered using Validations as an alternative?
 
Upvote 0
Not sure how that helps, but thanks.

For now, I'm opting to use application.inputbox, type:=8.

Code:
Set oFound = Rows(1).Find("Email Address")
If oFound Is Nothing Then Set oFound = Rows(1).Find("Con Email")
If oFound Is Nothing Then
    On Error Resume Next
    Set oFound = Application.InputBox( _
            "Select the cell in the top row of the column that contains your email address list.", _
            "Emailerator", Type:=8)
    If oFound Is Nothing Then End
End If
 
Upvote 0
Pleased to read you have something to work with, but your message does ask about a drop down.


Although you might not want a userform it might be a better option, you can always call it from the worksheet you are on and then adjust the list to the range within the sheet, if that helps you!:rolleyes:
 
Upvote 0
Thanks Trevor. I pretty much expected the answer to be "no". I appreciate you're looking at it, though.
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,741
Members
452,940
Latest member
rootytrip

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
Back
Top