Thread: Drop Down List
View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.newusers
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Drop Down List

To enter the number in the same cell use this example sheet event code.

Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("A1") 'edit to suit the DV cell(s)
If Intersect(Target, r) Is Nothing Then
Exit Sub
End If
vals = Array("A", "B", "C", "D", "E", "F") 'edit to suit
nums = Array(1, 2, 3, 4, 5, 6) 'add more numbers
For Each rr In r
ival = 0
For i = LBound(vals) To UBound(vals)
If UCase(rr.Value) = vals(i) Then
ival = nums(i)
End If
Next
If ival 0 Then
rr.Value = ival
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Thu, 24 Jul 2008 09:53:16 -0700 (PDT), Pete
wrote:

is it possible to choose an item from a dropdown list which will enter
a different value other than that chosen. Why I want to do this is as
follows:

We have 20 steps in our Process and each one is assigned a number e.g

1 = Forming
2 = Drying
3 = Paper
4 = Cutter

etc etc

I would like to display the Text in a Drop down for that Cell but
enter the corresponding Number into the Cell. If I chose Drying I
would like to see the number 2 appear in the Cell, or if I chose
Cutter I would like the Number 4 to be entered in the Cell.

Thanks

Pete