Using functions like formulas in Excel
- by Arlen Beiler
I am trying to use a formula to get a letter of the alphabet.
Formula:
=Keytable(RANDOM,ROW())
Function:
Function KeyTable(seed As Long, position As Long) As String
Dim i As Long
Stop
Dim calpha(1 To 26) As String
Dim alpha(1 To 26) As String
For i = 1 To 26
alpha(i) = Chr(i + UPPER_CASE - 1)
Next i
For i = 1 To 26
calpha(i) = alpha(seed Mod 27 - i)
Next i
Stop
KeyTable = calpha(position)
End Function
Result:
#Value!
When I step through the function, it never gets to the second stop.