How to Convert Amount AED to English Words in Excel Sheet



How to Convert a Numeric Value into English  Words in Excel 2007-2010

______________________________________________________









How to create the sample function Called SpellNumber

  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.
Option Explicit
'Main Function
Function SpellNum_Dirham(ByVal MyNumber)
    Dim Dirham, Fils, Temp
    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 Fils and set MyNumber to dollar amount.
    If DecimalPlace > 0 Then
        Fils = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _
                  "00", 2))
        MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
    End If
    Count = 1
    Do While MyNumber <> ""
        Temp = GetHundreds(Right(MyNumber, 3))
        If Temp <> "" Then Dirham = Temp & Place(Count) & Dirham
        If Len(MyNumber) > 3 Then
            MyNumber = Left(MyNumber, Len(MyNumber) - 3)
        Else
            MyNumber = ""
        End If
        Count = Count + 1
    Loop
    Select Case Dirham
        Case ""
            Dirham = "No Dirham"
        Case "One"
            Dirham = "One Dollar"
         Case Else
            Dirham = Dirham & " Dirham"
    End Select
    Select Case Fils
        Case ""
            Fils = " and No Fils"
        Case "One"
            Fils = " and One Cent"
              Case Else
            Fils = " and " & Fils & " Fils"
    End Select
    SpellNum_Dirham = Dirham & Fils
End Function
____________________________________________________

Labels: , ,



Leave A Comment: