Thank you so much for your very educative playlist. In your previous video with immediate Window, i changed the name Sheet by worksheet and it worked . Practising each of your tutorials is divine
Dear Mr Pawan please show where is the note pad to download to copy spell program explaining every minute thing very patiently excellent teaching skill Thank you
Hi , thank you so much for such a useful video, Can you please make a video about how to covert any word to numbers? I am assuming it should be binary numbers or whatever you think it will work.
Where is the notepad which you have shared? After clicking link I have visit your page but I don't have found so tell me about exact location into the page. Thanks
How do you get such a large and interactive screen in your background for this presentation? It’s very cool! Are you projecting your computer to a screen?
I am getting an error at the line: Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _ "00", 2)) The error says "Compile error: Syntax error" Do you have any suggestions?
use the below script ------------------------------------------ Option Explicit 'Main Function Function SpellNumber(ByVal MyNumber) Dim Dollars, Cents, 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 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 Do While MyNumber "" Temp = GetHundreds(Right(MyNumber, 3)) If Temp "" Then Dollars = Temp & Place(Count) & Dollars If Len(MyNumber) > 3 Then MyNumber = Left(MyNumber, Len(MyNumber) - 3) Else MyNumber = "" End If Count = Count + 1 Loop Select Case Dollars Case "" Dollars = "Zero Dollars" Case "One" Dollars = "One Dollar" Case Else Dollars = Dollars & " Dollars" End Select Select Case Cents Case "" Cents = " and Zero Cents" Case "One" Cents = " and One Cent" Case Else Cents = " and " & Cents & " Cents" End Select SpellNumber = Dollars & Cents End Function ' Converts a number from 100-999 into text 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 = GetDigit(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 & GetDigit(Mid(MyNumber, 3)) End If GetHundreds = Result End Function ' Converts a number from 10 to 99 into text. 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 & GetDigit _ (Right(TensText, 1)) ' Retrieve ones place. End If GetTens = Result End Function ' Converts a number from 1 to 9 into text. Function GetDigit(Digit) Select Case Val(Digit) Case 1: GetDigit = "One" Case 2: GetDigit = "Two" Case 3: GetDigit = "Three" Case 4: GetDigit = "Four" Case 5: GetDigit = "Five" Case 6: GetDigit = "Six" Case 7: GetDigit = "Seven" Case 8: GetDigit = "Eight" Case 9: GetDigit = "Nine" Case Else: GetDigit = "" End Select End Function
hai sir our excel data base file is in server and it is not converting to numbers it shows on warning "SECURITY RISK Micosoft has blocked macros from running because the source of this file is untrusted" please advise what to do for this
Dear need help on formatting a Textbox for a form , of First three alpha, last two numbers separated by a "-" , somewhat (a,a,a,"-" ,n,n) with length of 6
Any help please ! I have this message on my screen Error of compilation Variable not defineted And the word "cents" is selected on virtual basic. What can I do?
Function ConvertToText(number As Double) As String Dim units As Variant Dim tens As Variant Dim ones As Variant Dim result As String ' Define arrays for units, tens, and ones places units = Array("", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine") tens = Array("", "Ten", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety") ones = Array("", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen") ' Check if the number is zero If number = 0 Then ConvertToText = "Zero" Exit Function End If ' Extract digits from the number Dim hundredsDigit As Integer Dim tensDigit As Integer Dim onesDigit As Integer hundredsDigit = Int((number Mod 1000) / 100) tensDigit = Int((number Mod 100) / 10) onesDigit = Int(number Mod 10) ' Convert hundreds place to text If hundredsDigit > 0 Then result = units(hundredsDigit) & " Hundred" End If ' Convert tens and ones places to text If tensDigit > 1 Then result = result & " " & tens(tensDigit) If onesDigit > 0 Then result = result & " " & units(onesDigit) End If ElseIf tensDigit = 1 Then result = result & " " & ones(onesDigit) ElseIf onesDigit > 0 Then result = result & " " & units(onesDigit) End If ' Trim leading and trailing spaces ConvertToText = Trim(result) End Function You can also generate this code from Chat GPT.
Option Explicit 'Main Function Function SpellNumber(ByVal MyNumber) Dim Dollars, Cents, 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 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 Do While MyNumber "" Temp = GetHundreds(Right(MyNumber, 3)) If Temp "" Then Dollars = Temp & Place(Count) & Dollars If Len(MyNumber) > 3 Then MyNumber = Left(MyNumber, Len(MyNumber) - 3) Else MyNumber = "" End If Count = Count + 1 Loop Select Case Dollars Case "" Dollars = "No Dollars" Case "One" Dollars = "One Dollar" Case Else Dollars = Dollars & " Dollars" End Select Select Case Cents Case "" Cents = " and No Cents" Case "One" Cents = " and One Cent" Case Else Cents = " and " & Cents & " Cents" End Select SpellNumber = Dollars & Cents End Function ' Converts a number from 100-999 into text 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 = GetDigit(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 & GetDigit(Mid(MyNumber, 3)) End If GetHundreds = Result End Function ' Converts a number from 10 to 99 into text. 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 & GetDigit _ (Right(TensText, 1)) ' Retrieve ones place. End If GetTens = Result End Function ' Converts a number from 1 to 9 into text. Function GetDigit(Digit) Select Case Val(Digit) Case 1: GetDigit = "One" Case 2: GetDigit = "Two" Case 3: GetDigit = "Three" Case 4: GetDigit = "Four" Case 5: GetDigit = "Five" Case 6: GetDigit = "Six" Case 7: GetDigit = "Seven" Case 8: GetDigit = "Eight" Case 9: GetDigit = "Nine" Case Else: GetDigit = "" End Select End Function Copy and paste in module. do it. Function SpellNumber
Sir... I need your help. i need to change Doller and cents change Indian rupees and paisa . How it is possible? "Indian Rupees" how it's come? can you pls explain me
Respected Sir, With due respect . i would like to thanks from the core of hart. Your working is too good many persons learn from your videos like me. i have to write due to a problem that some micro module working in my office PC but not in my home PC bout have same window of office 2010 please help
There is a library available to do it in French in Google sheets.. Instructions available in this video. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-ZYkt3jduwAY.html
Invoice No=01 Now suppose I am working for January. then I need my invoice Number to increase by 1 after that if the month changes to February then again my invoice Number should start from 1 and get increase by 1 for each new invoice. It should follow the same every time the month get's changed. what is the possible vba code for this. please reply