jannette,
Use VLOOKUP for this task.
Assuming that you have this list On Sheet2, in the range A1:B5
Name Code
Apple 1020
Pear 1254
Orange 1510
Lemon 2511
On Sheet1...
in cell B1, enter: Orange
in cell B2, enter this formula: =VLOOKUP(B1,Sheet2!A1:B5,2
Ture Magnusson
Karlstad, Sweden
Main Topics
Browse All Topics





by: antratPosted on 1999-09-11 at 13:36:12ID: 2039432
Hi jannette
Val Sh As Object) =False
B1").Text = "A" Then op, Operator:= _
B1").Text = "B" Then op, Operator:= _
If I understand you correctly this will do the the trick
First create the named ranges you want to be used to populate your list
then hit Alt+F11 to start the Visual basic Editor
Next double click "ThisWorkBook" in the properties window.
Then paste this code in and change the range names and cell addresses to suit your needs.
Private Sub Workbook_SheetCalculate(By
Application.ScreenUpdating
'"A" can be changed to any text you want
'If you are using numbers change text to value
If Worksheets("Page").Range("
Range("B2").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertSt
xlBetween, Formula1:="=Number" 'put this named
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End If
If Worksheets("Page").Range("
Range("B2").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertSt
xlBetween, Formula1:="=fruit" 'put this named range
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End If
'Simply repeat each block if statement
'For each value that you want a change to take effect
End Sub
Please let me know if I have missunderstood you
Antrat