Skip to main content

Number convert to words

Number convert to words 


Virtual Learning Earning Channel

Steps to Add the Macro

  1. Open Excel and press ALT + F11 to open the VBA Editor.
  2. Click Insert > Module.
  3. Copy and paste the code below into the module.
  4. Close the VBA Editor and return to Excel.
  5. Use the function in a cell like =NumberToWords(A1).

VBA Code for Digit-by-Digit Conversion


Function NumberToWords(ByVal MyNumber As String) As String

    Dim i As Integer

    Dim Result As String

    Dim Digit As String

    

    ' Loop through each digit in the number

    For i = 1 To Len(MyNumber)

        Digit = Mid(MyNumber, i, 1)

        Select Case Digit

            Case "0": Result = Result & " Zero"

            Case "1": Result = Result & " One"

            Case "2": Result = Result & " Two"

            Case "3": Result = Result & " Three"

            Case "4": Result = Result & " Four"

            Case "5": Result = Result & " Five"

            Case "6": Result = Result & " Six"

            Case "7": Result = Result & " Seven"

            Case "8": Result = Result & " Eight"

            Case "9": Result = Result & " Nine"

        End Select

    Next i

    

    ' Trim leading space and return the result

    NumberToWords = Trim(Result)

End Function


How to Use:

  • In Excel, enter a number in a cell (e.g., 123 in A1).
  • In another cell, type:
    =NumberToWords(A1)
  • It will return:
    "One Two Three"

Comments

Popular posts from this blog

Spell Number Function

  How to Convert Number into Words in MS Excel | Spell Number in Excel | MS Excel Tips & Tricks @1 In Microsoft Excel, you can't directly write a function like a traditional programming language. However, you can use  VBA (Visual Basic for Applications)  to create custom functions, like a "spell" function, which converts numbers into words. Here's an example of how to write a  VBA spell function  that converts numbers to words in Excel: Step-by-step guide to create the function: Open Excel. Press  Alt + F11  to open the  VBA editor . In the VBA editor, click  Insert  >  Module . Paste the following code into the module:   Function SpellNumber(ByVal MyNumber)     Dim Units As String     Dim Cents As String     Dim DecimalPlace As Integer     Dim Count As Integer     Dim Place(9) As String     Dim Hundreds As String          Pl...

Add Record & Save Record into another Microsoft Excel Sheet

I want macro only select that records from Sno 1 to 10 which have code and ONLY Transfer values to anther sheet in excel ? Below is a VBA macro designed to copy only the values (not formulas) from rows with a valid Code (non-empty in the "Code" column) for Sno 1 to 10 from the source sheet and paste them into the target sheet. Sub CopyValidRecords()     Dim SourceSheet As Worksheet, TargetSheet As Worksheet     Dim LastRow As Long, TargetRow As Long     Dim i As Long     ' Set worksheets     Set SourceSheet = ThisWorkbook.Sheets("Source") ' Replace "Source" with your source sheet name     Set TargetSheet = ThisWorkbook.Sheets("Target") ' Replace "Target" with your target sheet name     ' Find the next empty row in the target sheet     TargetRow = TargetSheet.Cells(TargetSheet.Rows.Count, "A").End(xlUp).Row + 1     ' Loop through Sno 1 to 10 in the source sheet     For i = 1 To 10 ...