NameNum

Finding the number of a name, used in a numerology program.
Finds the number that represents certain name.


Public

Not Tested

Not My Work

Public Function NameNum(sName) As Long
 name2 = LCase(sName)
 For letter = 1 To Len(sName)
  Name4 = Mid(name2, letter, 1)
  'Debug.Print Name4
  Select Case Name4
  Case "a"
   Number = Number + 1
  Case "b"
   Number = Number + 2
  Case "c"
   Number = Number + 3
  Case "d"
   Number = Number + 4
  Case "e"
   Number = Number + 5
  Case "f"
   Number = Number + 6
  Case "g"
   Number = Number + 7
  Case "h"
   Number = Number + 8
  Case "i"
   Number = Number + 9
  Case "j"
   Number = Number + 1
  Case "k"
   Number = Number + 2
  Case "l"
   Number = Number + 3
  Case "m"
   Number = Number + 4
  Case "n"
   Number = Number + 5
  Case "o"
   Number = Number + 6
  Case "p"
   Number = Number + 7
  Case "q"
   Number = Number + 8
  Case "r"
   Number = Number + 9
  Case "s"
   Number = Number + 1
  Case "t"
   Number = Number + 2
  Case "u"
   Number = Number + 3
  Case "v"
   Number = Number + 4
  Case "w"
   Number = Number + 5
  Case "x"
   Number = Number + 6
  Case "y"
   Number = Number + 7
  Case "z"
   Number = Number + 8
  Case " "
   Number = Number + 0
  End Select
 Next
 ' Debug.Print Number
 Nu = Val(Number)
 Do
  Nu = Val(Mid(CVar(Nu), 1, 1)) + Val(Mid(CVar(Nu), 2, 1))
  'Debug.Print Nu
 Loop Until Nu < 10
 NameNum = Nu
End Function

sName

Views 249 Downloads 79

VBA Math
ANmarAmdeen
725
Attachments
Revisions

v1.0