Dropdown list where user chooses a value, but only a code is entered in the cell

BarefootPaul

Board Regular
Joined
Jul 21, 2011
Messages
54
I want a drop down list where the user can choose from a list of descriptions, but then have a number code for that description be what is retained in the cell. How do I do that?

Thanks
 
After far more time than it should have taken me, I have it working now. However, I have one more question about it. How do I make the dropdown list wider than the column? The column is really narrow since it only needs to have a 2 digit number stored in it, but the description that is used in the data validation match is much longer and the user won't be able to distinguish some of them if they can't read more than the column width allows.

I can't make the colomn wider because there is not room to do that and keep it all on a single printed page. There are actually 6 different columns that this applies to.

Thanks.
Maybe you can resize the column when the macro fires and then reset it after the selection has been made.

Since I'm not much of a programmer I'm not exactly sure on how to do that but with some experimentation you should be able to figure it out.
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
It can be done without VBA if your codes are numbers. Create a list of the numbers only. Then for each cell in the list use format/cells/custom and in the custom number format box type "Your Description". After doing this, your list will appear to have the description only, when in fact the data is the code only. You can now use data/validation/list for data validation. When selecting from the list via the cell dropdown, only the code will be entered into the cell.


Thank you so much, what a simple solution !:)
 
Upvote 0

Forum statistics

Threads
1,224,618
Messages
6,179,917
Members
452,949
Latest member
beartooth91

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