![]() Private Function EnglishNumberDigitGroup(ByVal N As Integer) As StringĬase 3: Buf = Three & Hundred: Flag = TrueĬase 4: Buf = Four & Hundred: Flag = TrueĬase 5: Buf = Five & Hundred: Flag = TrueĬase 7: Buf = Seven & Hundred: Flag = TrueĬase 8: Buf = Eight & Hundred: Flag = TrueĬase 9: Buf = Nine & Hundred: Flag = TrueĬase 2: Buf = Buf & "twenty": Flag = TrueĬase 3: Buf = Buf & "thirty": Flag = TrueĬase 7: Buf = Buf & "seventy": Flag = TrueĬase 8: Buf = Buf & "eighty": Flag = TrueĬase 9: Buf = Buf & "ninety": Flag = True If (N = Then EnglishNumber = "zero": Exit Functionĭim Buf As String: If (N Then N = Abs(Fix(N))ĭim AtLeastOne As Integer: AtLeastOne = N >= 1īuf = Buf & EnglishNumberDigitGroup(Int(N / Trillion)) & " trillion"īuf = Buf & EnglishNumberDigitGroup(Int(N / Billion)) & " billion"īuf = Buf & EnglishNumberDigitGroup(N \ Million) & " million"īuf = Buf & EnglishNumberDigitGroup(N \ Thousand) & " thousand" ' Example created by įunction EnglishNumber(ByVal N As Currency) As StringĬonst Thousand = Million = Thousand * Thousand Paste the following two functions into the new module. ![]() This will insert a new module in your spreadsheet called Module1. ![]() First, you'll need to open your Excel spreadsheet and press Alt+ F11 to open the Microsoft Visual Basic for Applications window. You will need to enable the macros for the function to work properly. When you open your file after creating the custom function, it will warn that there are macros in the spreadsheet. TIP: When you create a custom function in Excel, it will create macro code.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |