-----Original Message-----
Mika,
This may actually work better without a Macro.
Try this.
In a new worksheet create the following table
(It is possible to do this within your existing sheet but I like to do
tables outside my input sheet)
two columns
a b
"bmO" 2
"bmT" 2
"bnMF" 3
........ thousands of combinations are possible.
The text string should match the combination you desire to choose and can be
any length.
This new sheet can be Hidden if you desire so users never see it,
You can maintain your options easily without touching any code.
Name these columns as a range. Use something convenient. "Options"
perhaps.
Now on your first sheet the formula in a4 would look something like this.
=vlookup(concatenate(a1,a2,a3),options,2,false)
What your doing is simply creating a text string from your choices.
Then looking that string up in a table to get the result that matches the
value from Column b on the new sheet.
The vlookup can be used again and again.
Hope this helps
Gary M.
A User-Defined Function should do what you want.
Function FillCell(rngA As Range, rngB As Range, rngC As Range) As
Variant
Application.Volatile
If rngA.Value = "o" And rngB.Value = "m" And rngC.Value = "l" Then
FillCell = 87
ElseIf rngA.Value = "o" And rngB.Value = 1 And rngC.Value = 6 Then
FillCell = 65
ElseIf ' As many combos as you need.
Else
FillCell = "Combination not valid."
End If
End Function
--------------------------------------------------------
------------------
-------
Place this formula in Cell D1.
=FillCell(A1,B1,C1)
--------------------------------------------------------
------------------
-------
When you change any of the values in the three cells, the value in D1
should change.
You can copy this function down Column D as many times as needed.
You'll need to adjust the code to get the combination that you're
seeking.
HTH
Paul
--------------------------------------------------------
------------------ ------------------
.