Drop Down List With Details

CHeil402

New Member
Joined
Jul 3, 2008
Messages
5
I'm not quite sure how to accomplish this, but I want to have a drop down list with abbreviations and details, but when you pick an option, only the abbreviation goes into the target cell. For example if I made a drop down list that had state abbreviations AND their descriptions (PA-Pennsylvania, VA-Virginia, MD-Maryland, etc...) but wanted only the abbreviation to be selected (PA, VA, MD) once you make a selection. Is there a way to do this? I have the abbreviations in one column and the descriptions in another, but so far I've only been able to make a list of one or the other, not both.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
I don't think there's an easy way to do that.

Could you instead have say the dropdown in A1 returning the abbreviation and description - and then in A2 put = LEFT(A1,2) - that would give you just the abbreviation, and you could drive whatever you needed from that?
 
Upvote 0
You could try this in the module for the Worksheet:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Application.EnableEvents = False
    If Target.Address = "$A$1" Then
        Target.Value = Left(Target.Value, 2)
    End If
    Application.EnableEvents = True
End Sub

Change the reference to $A$1 to refer to your data validation cell.
 
Upvote 0
Andrew - that's so cool - I just assumed that doing that wouldn't work. Why doesn't the data validation object to it?
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

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