Kirill S. Palagin wrote:

Hello.

I am trying to find a way to generate numeral out of integer:
1 - "one"
3 - "three"
22 - "twenty two"

in my language (Russian).
Is there a function for that in Calc?
You can write and save a macro and Calc will allow you to call it in the same way as you call other formula functions.

See http://www.freevbcode.com/ShowCode.asp?ID=6475 for an example VB6 macro that does what you want (more detailed than my simple version below).

For example, calling the following (single digit argument) macro function as "=DIGITTOTEXT(8)" will produce "Eight". The argument can also be a cell reference or any other expression that yields a single digit number, e.g. "=DIGITTOTEXT(A1+4)".

Go to the macro editor "Tools - Macros - Organize Macros - OpenOffice.org Basic" and cut&paste the following into the MyMacros.Standard module, or somewhere similar will also work I think.

Function DigitToText (X) As String
   Dim T As String
   Select Case X
       Case 0
           T = "Zero"
       Case 1
           T = "One"
       Case 2
           T = "Two"
       Case 3
           T = "Three"
       Case 4
           T = "Four"
       Case 5
           T = "Five"
       Case 6
           T = "Six"
       Case 7
           T = "Seven"
       Case 8
           T = "Eight"
       Case 9
           T = "Nine"
       Case Else
           T = "###"
   End Select
   DigitToText = T
End Function

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to