Data Validation in 2007

J

Joe H

Is there a way to make the Data Validation dropdown list dispaly
descriptions but when you select one it puts in the corrosponding ID
instead?

Example:

Name: Phone #
Smith 360-482-4747
Bowers 360-482-7878
Gates 360-482-8877

So when I'm in the cell and hit the drop down and Select "Bowers" - it
actually saves the phone number "360-482-7878" instead of "Bowers"
 
B

Bernard Liengme

Not directly but in an adjacent cell you could use VLOOKUP to pickup the
phone-number
best wishes
 
B

Bob Umlas

Yes, you can. If your dropdown is in G2, for example, and you have the
entire table o4 values n M2:N5, for eaxmple, you can right-click the sheet
tab, select View Code, and put this in:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$G$2" Then
Application.EnableEvents = False
Target.Value = Application.VLookup(Target, Range("M2:N5"), 2, False)
Application.EnableEvents = True
End If
End Sub
Now, when you select Bowers, you'll see 360-482-7878!

Bob Umlas
Excel MVP
 

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