SlideShare a Scribd company logo
1 of 8
1.   Start Microsoft Excel.

      2.   Press ALT+F11 to start the Visual Basic Editor.
      3.   On the Insert menu, click Module.

      4.   Type the following code into the module sheet.

      5.   Finally you will get the conversion with spell rupees




'****************

  ' Main Function *

  '****************



  Function SpellRupee(ByVal MyNumber)

    Dim Dollars, Cents, Temp, Temp1, Dollars1, Temp2

    Dim DecimalPlace, Count



    ReDim Place(9) As String

    Place(2) = " THOUSAND "

    Place(3) = " Million "

    Place(4) = " Billion "

    Place(5) = " Trillion "



    ' String representation of amount.

    MyNumber = Trim(Str(MyNumber))



    ' Position of decimal place 0 if none.

    DecimalPlace = InStr(MyNumber, ".")
' Convert cents and set MyNumber to dollar amount.

     If DecimalPlace > 0 Then

         Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _

           "00", 2))

         MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))

     End If



     Count = 1

Temp2 = ""

If Len(MyNumber) > 7 Then

     Temp2 = GetHundreds(Left(MyNumber, Len(MyNumber) - 7)) & " CORES "

MyNumber = Right(MyNumber, 7)



End If



     Temp1 = ""

     If Len(MyNumber) > 5 Then

     Temp1 = GetHundreds(Left(MyNumber, Len(MyNumber) - 5)) & " LAKHS "

MyNumber = Right(MyNumber, 5)



     End If



     Do While MyNumber <> ""

         Temp = GetHundreds(Right(MyNumber, 3))

         If Temp <> "" Then Dollars1 = Temp & Place(Count) & Dollars1
If Len(MyNumber) > 3 Then

    MyNumber = Left(MyNumber, Len(MyNumber) - 3)

  Else

    MyNumber = ""

  End If

  Count = Count + 1

Loop

Dollars = Temp2 & Temp1 & Dollars1

Select Case Dollars

  Case ""

    Dollars = "NIL RUPEES"

  Case "One"

    Dollars = "ONE RUPEE "

  Case Else

    Dollars = " RUPEES " & Dollars & " ONLY "

End Select



Select Case Cents

  Case ""

    Cents = " "

  Case "One"

    Cents = " "

  Case Else

    Cents = " AND " & Cents & " PAISA"

End Select
SpellRupee = Dollars & Cents

End Function




'*******************************************

' Converts a number from 100-999 into text *

'*******************************************



Private Function GetHundreds(ByVal MyNumber)

  Dim Result As String



  If Val(MyNumber) = 0 Then Exit Function

  MyNumber = Right("000" & MyNumber, 3)



  ' Convert the hundreds place.

  If Mid(MyNumber, 1, 1) <> "0" Then

    Result = GetNumber(Mid(MyNumber, 1, 1)) & " HUNDRED "

  End If



  ' Convert the tens and ones place.

  If Mid(MyNumber, 2, 1) <> "0" Then

    Result = Result & GetTens(Mid(MyNumber, 2))

  Else
Result = Result & GetNumber(Mid(MyNumber, 3))

  End If



  GetHundreds = Result

End Function




'*********************************************

' Converts a number from 10 to 99 into text. *

'*********************************************



Private Function GetTens(TensText)

  Dim Result As String



  Result = ""      ' Null out the temporary function value.

  If Val(Left(TensText, 1)) = 1 Then ' If value between 10-19...

    Select Case Val(TensText)

      Case 10: Result = "TEN"

      Case 11: Result = "ELEVEN"

      Case 12: Result = "TWELVE"

      Case 13: Result = "THIRTEEN"

      Case 14: Result = "FOURTEEN"

      Case 15: Result = "FIFTEEN"

      Case 16: Result = "SIXTEEN"
Case 17: Result = "SEVENTEEN"

         Case 18: Result = "EIGHTEEN"

         Case 19: Result = "NINETEEN"

         Case Else

    End Select

  Else                     ' If value between 20-99...

    Select Case Val(Left(TensText, 1))

         Case 2: Result = "TWENTY "

         Case 3: Result = "THIRTY "

         Case 4: Result = "FORTY "

         Case 5: Result = "FIFTY "

         Case 6: Result = "SIXTY "

         Case 7: Result = "SEVENTY "

         Case 8: Result = "EIGHTY "

         Case 9: Result = "NINETY "

         Case Else

    End Select

    Result = Result & GetNumber _

         (Right(TensText, 1)) ' Retrieve ones place.

  End If

  GetTens = Result

End Function
'*******************************************

' Converts a number from 1 to 9 into text. *

'*******************************************



Private Function GetNumber(Digit)

  Select Case Val(Digit)

    Case 1: GetNumber = "ONE"

    Case 2: GetNumber = "TWO"

    Case 3: GetNumber = "THREE"

    Case 4: GetNumber = "FOUR"

    Case 5: GetNumber = "FIVE"

    Case 6: GetNumber = "SIX"

    Case 7: GetNumber = "SEVEN"

    Case 8: GetNumber = "EIGHT"

    Case 9: GetNumber = "NINE"

    Case Else: GetNumber = ""

  End Select

End Function
52 excel rupees converter formulae

More Related Content

Similar to 52 excel rupees converter formulae

unction NumberToWords.docx
unction NumberToWords.docxunction NumberToWords.docx
unction NumberToWords.docxpardeepwalia6
 
Fungsi Terbilang Valid 100%
Fungsi Terbilang Valid 100%Fungsi Terbilang Valid 100%
Fungsi Terbilang Valid 100%dnugroho78
 
ComEd101 - Chapter 2 Lesson 2.pptx
ComEd101 - Chapter 2 Lesson 2.pptxComEd101 - Chapter 2 Lesson 2.pptx
ComEd101 - Chapter 2 Lesson 2.pptxJohnPaulNavarro7
 
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxPROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxamrit47
 
Swift 5.1 Language Guide Notes.pdf
Swift 5.1 Language Guide Notes.pdfSwift 5.1 Language Guide Notes.pdf
Swift 5.1 Language Guide Notes.pdfJkPoppy
 
C# using Visual studio - Windows Form. If possible step-by-step inst.pdf
C# using Visual studio - Windows Form. If possible step-by-step inst.pdfC# using Visual studio - Windows Form. If possible step-by-step inst.pdf
C# using Visual studio - Windows Form. If possible step-by-step inst.pdffazalenterprises
 
Introduction to Kotlin.pptx
Introduction to Kotlin.pptxIntroduction to Kotlin.pptx
Introduction to Kotlin.pptxAzharFauzan9
 
01 Introduction to Kotlin - Programming in Kotlin.pptx
01 Introduction to Kotlin - Programming in Kotlin.pptx01 Introduction to Kotlin - Programming in Kotlin.pptx
01 Introduction to Kotlin - Programming in Kotlin.pptxIvanZawPhyo
 
Basic calculator tutorial
Basic calculator tutorialBasic calculator tutorial
Basic calculator tutorialGilkye
 
Programada chapter 4
Programada chapter 4Programada chapter 4
Programada chapter 4abdallaisse
 
Sine Wave Generator with controllable frequency displayed on a seven segment ...
Sine Wave Generator with controllable frequency displayed on a seven segment ...Sine Wave Generator with controllable frequency displayed on a seven segment ...
Sine Wave Generator with controllable frequency displayed on a seven segment ...Karthik Rathinavel
 
Answers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And EngineersAnswers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And EngineersSheila Sinclair
 
Classical programming interview questions
Classical programming interview questionsClassical programming interview questions
Classical programming interview questionsGradeup
 
C++ Course - Lesson 2
C++ Course - Lesson 2C++ Course - Lesson 2
C++ Course - Lesson 2Mohamed Ahmed
 
Python 04-ifelse-return-input-strings.pptx
Python 04-ifelse-return-input-strings.pptxPython 04-ifelse-return-input-strings.pptx
Python 04-ifelse-return-input-strings.pptxTseChris
 
208180 building-number-place-value
208180 building-number-place-value208180 building-number-place-value
208180 building-number-place-valueFathimaRifa
 

Similar to 52 excel rupees converter formulae (20)

unction NumberToWords.docx
unction NumberToWords.docxunction NumberToWords.docx
unction NumberToWords.docx
 
Fungsi Terbilang Valid 100%
Fungsi Terbilang Valid 100%Fungsi Terbilang Valid 100%
Fungsi Terbilang Valid 100%
 
Terbilang
TerbilangTerbilang
Terbilang
 
ComEd101 - Chapter 2 Lesson 2.pptx
ComEd101 - Chapter 2 Lesson 2.pptxComEd101 - Chapter 2 Lesson 2.pptx
ComEd101 - Chapter 2 Lesson 2.pptx
 
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxPROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
 
Swift 5.1 Language Guide Notes.pdf
Swift 5.1 Language Guide Notes.pdfSwift 5.1 Language Guide Notes.pdf
Swift 5.1 Language Guide Notes.pdf
 
TEST DATA
TEST DATATEST DATA
TEST DATA
 
C# using Visual studio - Windows Form. If possible step-by-step inst.pdf
C# using Visual studio - Windows Form. If possible step-by-step inst.pdfC# using Visual studio - Windows Form. If possible step-by-step inst.pdf
C# using Visual studio - Windows Form. If possible step-by-step inst.pdf
 
Introduction to Kotlin.pptx
Introduction to Kotlin.pptxIntroduction to Kotlin.pptx
Introduction to Kotlin.pptx
 
01 Introduction to Kotlin - Programming in Kotlin.pptx
01 Introduction to Kotlin - Programming in Kotlin.pptx01 Introduction to Kotlin - Programming in Kotlin.pptx
01 Introduction to Kotlin - Programming in Kotlin.pptx
 
Basic calculator tutorial
Basic calculator tutorialBasic calculator tutorial
Basic calculator tutorial
 
Decompiladores
DecompiladoresDecompiladores
Decompiladores
 
Programada chapter 4
Programada chapter 4Programada chapter 4
Programada chapter 4
 
Sine Wave Generator with controllable frequency displayed on a seven segment ...
Sine Wave Generator with controllable frequency displayed on a seven segment ...Sine Wave Generator with controllable frequency displayed on a seven segment ...
Sine Wave Generator with controllable frequency displayed on a seven segment ...
 
Answers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And EngineersAnswers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
Answers To Selected Exercises For Fortran 90 95 For Scientists And Engineers
 
Classical programming interview questions
Classical programming interview questionsClassical programming interview questions
Classical programming interview questions
 
C++ Course - Lesson 2
C++ Course - Lesson 2C++ Course - Lesson 2
C++ Course - Lesson 2
 
Python 04-ifelse-return-input-strings.pptx
Python 04-ifelse-return-input-strings.pptxPython 04-ifelse-return-input-strings.pptx
Python 04-ifelse-return-input-strings.pptx
 
208180 building-number-place-value
208180 building-number-place-value208180 building-number-place-value
208180 building-number-place-value
 
Vb file
Vb fileVb file
Vb file
 

Recently uploaded

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 

Recently uploaded (20)

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 

52 excel rupees converter formulae

  • 1. 1. Start Microsoft Excel. 2. Press ALT+F11 to start the Visual Basic Editor. 3. On the Insert menu, click Module. 4. Type the following code into the module sheet. 5. Finally you will get the conversion with spell rupees '**************** ' Main Function * '**************** Function SpellRupee(ByVal MyNumber) Dim Dollars, Cents, Temp, Temp1, Dollars1, Temp2 Dim DecimalPlace, Count ReDim Place(9) As String Place(2) = " THOUSAND " Place(3) = " Million " Place(4) = " Billion " Place(5) = " Trillion " ' String representation of amount. MyNumber = Trim(Str(MyNumber)) ' Position of decimal place 0 if none. DecimalPlace = InStr(MyNumber, ".")
  • 2. ' Convert cents and set MyNumber to dollar amount. If DecimalPlace > 0 Then Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _ "00", 2)) MyNumber = Trim(Left(MyNumber, DecimalPlace - 1)) End If Count = 1 Temp2 = "" If Len(MyNumber) > 7 Then Temp2 = GetHundreds(Left(MyNumber, Len(MyNumber) - 7)) & " CORES " MyNumber = Right(MyNumber, 7) End If Temp1 = "" If Len(MyNumber) > 5 Then Temp1 = GetHundreds(Left(MyNumber, Len(MyNumber) - 5)) & " LAKHS " MyNumber = Right(MyNumber, 5) End If Do While MyNumber <> "" Temp = GetHundreds(Right(MyNumber, 3)) If Temp <> "" Then Dollars1 = Temp & Place(Count) & Dollars1
  • 3. If Len(MyNumber) > 3 Then MyNumber = Left(MyNumber, Len(MyNumber) - 3) Else MyNumber = "" End If Count = Count + 1 Loop Dollars = Temp2 & Temp1 & Dollars1 Select Case Dollars Case "" Dollars = "NIL RUPEES" Case "One" Dollars = "ONE RUPEE " Case Else Dollars = " RUPEES " & Dollars & " ONLY " End Select Select Case Cents Case "" Cents = " " Case "One" Cents = " " Case Else Cents = " AND " & Cents & " PAISA" End Select
  • 4. SpellRupee = Dollars & Cents End Function '******************************************* ' Converts a number from 100-999 into text * '******************************************* Private Function GetHundreds(ByVal MyNumber) Dim Result As String If Val(MyNumber) = 0 Then Exit Function MyNumber = Right("000" & MyNumber, 3) ' Convert the hundreds place. If Mid(MyNumber, 1, 1) <> "0" Then Result = GetNumber(Mid(MyNumber, 1, 1)) & " HUNDRED " End If ' Convert the tens and ones place. If Mid(MyNumber, 2, 1) <> "0" Then Result = Result & GetTens(Mid(MyNumber, 2)) Else
  • 5. Result = Result & GetNumber(Mid(MyNumber, 3)) End If GetHundreds = Result End Function '********************************************* ' Converts a number from 10 to 99 into text. * '********************************************* Private Function GetTens(TensText) Dim Result As String Result = "" ' Null out the temporary function value. If Val(Left(TensText, 1)) = 1 Then ' If value between 10-19... Select Case Val(TensText) Case 10: Result = "TEN" Case 11: Result = "ELEVEN" Case 12: Result = "TWELVE" Case 13: Result = "THIRTEEN" Case 14: Result = "FOURTEEN" Case 15: Result = "FIFTEEN" Case 16: Result = "SIXTEEN"
  • 6. Case 17: Result = "SEVENTEEN" Case 18: Result = "EIGHTEEN" Case 19: Result = "NINETEEN" Case Else End Select Else ' If value between 20-99... Select Case Val(Left(TensText, 1)) Case 2: Result = "TWENTY " Case 3: Result = "THIRTY " Case 4: Result = "FORTY " Case 5: Result = "FIFTY " Case 6: Result = "SIXTY " Case 7: Result = "SEVENTY " Case 8: Result = "EIGHTY " Case 9: Result = "NINETY " Case Else End Select Result = Result & GetNumber _ (Right(TensText, 1)) ' Retrieve ones place. End If GetTens = Result End Function
  • 7. '******************************************* ' Converts a number from 1 to 9 into text. * '******************************************* Private Function GetNumber(Digit) Select Case Val(Digit) Case 1: GetNumber = "ONE" Case 2: GetNumber = "TWO" Case 3: GetNumber = "THREE" Case 4: GetNumber = "FOUR" Case 5: GetNumber = "FIVE" Case 6: GetNumber = "SIX" Case 7: GetNumber = "SEVEN" Case 8: GetNumber = "EIGHT" Case 9: GetNumber = "NINE" Case Else: GetNumber = "" End Select End Function