Thread: Spell Numbers
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default Spell Numbers

I didn't explain, but I left the case else statement alone as I assumed
that this would mean what had been entered was non numeric, so you
wouldn't want it converted - you should probably also put in an error
trap to handle a zero length, as currently that would return 0

Marcelo wrote:
Aidan, thanks a lot, it's exact what I am looking for

Regards from Brazil
Marcelo

" escreveu:

amend your function slightly to loop for the LENgth of the input


Function GetDigit(Digit As String)
Dim CheckDigit As String
Dim looper
For looper = 1 To Len(Digit)
CheckDigit = Mid(Digit, looper, 1)
Select Case Val(CheckDigit)
Case 1: GetDigit = GetDigit & "A"
Case 2: GetDigit = GetDigit & "B"
Case 3: GetDigit = GetDigit & "C"
Case 4: GetDigit = GetDigit & "D"
Case 5: GetDigit = GetDigit & "E"
Case 6: GetDigit = GetDigit & "F"
Case 7: GetDigit = GetDigit & "G"
Case 8: GetDigit = GetDigit & "H"
Case 9: GetDigit = GetDigit & "I"
Case 0: GetDigit = GetDigit & "J"
Case Else: GetDigit = ""
End Select
Next
End Function



Marcelo wrote:
Thanks Andy, but the numbers could have more than 6 digits.

thanks for your response

"Andy" escreveu:

Hi
With your number (eg 5) in A2, use =CHAR(64+A2) to get the correct letter.
That's easy - for a single number. To get more than one (eg 543) you'd need
to know how many the maximum number of digits is.

Hope this helps.
Andy.

"Marcelo" wrote in message
...
Guys,

I am looking for a way to separate digits using VBA, for example. if I
have
123 in one cell, and I would like to have a function transforming 1 in A,
2
in B, etc, so the function for 123 should return ABC or CBA for 321.

best regards.

Marcelo from Brazil