ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   multiple validations (https://www.excelbanter.com/excel-worksheet-functions/201517-multiple-validations.html)

Koby W.

multiple validations
 
I have an excel file that has validation set up to choose numbers from a
list. In the column next to the numbers, I have a description of what the
numbers represent. Is there anyway to be view both columns in my drop down
list, but only insert the numbers? I thought maybe I could just merge the
two columns together and limit the number of characters that were actually
inserted into the cell, but I couldn't figure out how to do that. Any help
would be appreciated.

Bernie Deitrick

multiple validations
 
Koby,

Make up your list of validation values like

1 Description
2 Other stuff
3 blah blah
.....

So that the number is the left part, and the description is the right part of the string, separated
by a space.

Then copy this code, right-click the sheet tab, select "View Code" and paste the code into the
window that appears. Change the H5:H10 to the address of the range that you want to have this work
on.

Then, when the call value is changed, only the number to the left will appear in the cell.

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("H5:H10")) Is Nothing Then Exit Sub
If Target.Value = "" Then Exit Sub
Application.EnableEvents = False
On Error Resume Next
Target.Value = Left(Target.Value, InStr(1, Target.Value, " ") - 1)
Application.EnableEvents = True

End Sub

HTH,
Bernie
MS Excel MVP


"Koby W." <Koby wrote in message
...
I have an excel file that has validation set up to choose numbers from a
list. In the column next to the numbers, I have a description of what the
numbers represent. Is there anyway to be view both columns in my drop down
list, but only insert the numbers? I thought maybe I could just merge the
two columns together and limit the number of characters that were actually
inserted into the cell, but I couldn't figure out how to do that. Any help
would be appreciated.




T. Valko

multiple validations
 
There is a sample file here that demonstrates this:

http://contextures.com/excelfiles.html#DataVal

Look for: DV0004 - Data Validation Change

--
Biff
Microsoft Excel MVP


"Koby W." <Koby wrote in message
...
I have an excel file that has validation set up to choose numbers from a
list. In the column next to the numbers, I have a description of what the
numbers represent. Is there anyway to be view both columns in my drop
down
list, but only insert the numbers? I thought maybe I could just merge the
two columns together and limit the number of characters that were actually
inserted into the cell, but I couldn't figure out how to do that. Any
help
would be appreciated.





All times are GMT +1. The time now is 04:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com