oversætte et tal til tekst
Jeg har denne makro som jeg ikke kan få til at køre mere.Jeg har et tal i M44 og skal have det oversat i A47 til tekst.
Hvad laver jeg af fejl
Function suma_lt(ByVal suma) As String
'Funkcija pavercia zodziais suma pinigu
Dim ct$, x, Mase, MasesSuma, Liko, i, Liet$, Linksnis, Pirma$, Kitos$
suma_lt = ""
On Error GoTo klaida21
If suma > 999999999.99 Then
suma_lt = "Daugokai gaunasi..."
Exit Function
End If
Static pinigai$(3, 3)
pinigai$(1, 1) = "litas"
pinigai$(1, 2) = "litai"
pinigai$(1, 3) = "litø"
pinigai$(2, 1) = "tûkstantis"
pinigai$(2, 2) = "tûkstanèiai"
pinigai$(2, 3) = "tûkstanèiø"
pinigai$(3, 1) = "milijonas"
pinigai$(3, 2) = "milijonai"
pinigai$(3, 3) = "milijonø"
Static M(3)
M(1) = 1
M(2) = 1000
M(3) = 1000000
Const Max_sk = 36
Static SkaiciaiN(36)
SkaiciaiN(1) = 1
SkaiciaiN(2) = 2
SkaiciaiN(3) = 3
SkaiciaiN(4) = 4
SkaiciaiN(5) = 5
SkaiciaiN(6) = 6
SkaiciaiN(7) = 7
SkaiciaiN(8) = 8
SkaiciaiN(9) = 9
SkaiciaiN(10) = 10
SkaiciaiN(11) = 11
SkaiciaiN(12) = 12
SkaiciaiN(13) = 13
SkaiciaiN(14) = 14
SkaiciaiN(15) = 15
SkaiciaiN(16) = 16
SkaiciaiN(17) = 17
SkaiciaiN(18) = 18
SkaiciaiN(19) = 19
SkaiciaiN(20) = 20
SkaiciaiN(21) = 30
SkaiciaiN(22) = 40
SkaiciaiN(23) = 50
SkaiciaiN(24) = 60
SkaiciaiN(25) = 70
SkaiciaiN(26) = 80
SkaiciaiN(27) = 90
SkaiciaiN(28) = 100
SkaiciaiN(29) = 200
SkaiciaiN(30) = 300
SkaiciaiN(31) = 400
SkaiciaiN(32) = 500
SkaiciaiN(33) = 600
SkaiciaiN(34) = 700
SkaiciaiN(35) = 800
SkaiciaiN(36) = 900
Static SkaiciaiS$(36)
SkaiciaiS$(1) = "vienas"
SkaiciaiS$(2) = "du"
SkaiciaiS$(3) = "trys"
SkaiciaiS$(4) = "keturi"
SkaiciaiS$(5) = "penki"
SkaiciaiS$(6) = "ðeði"
SkaiciaiS$(7) = "septyni"
SkaiciaiS$(8) = "aðtuoni"
SkaiciaiS$(9) = "devyni"
SkaiciaiS$(10) = "deðimt"
SkaiciaiS$(11) = "vienuolika"
SkaiciaiS$(12) = "dvylika"
SkaiciaiS$(13) = "trylika"
SkaiciaiS$(14) = "keturiolika"
SkaiciaiS$(15) = "penkiolika"
SkaiciaiS$(16) = "ðeðiolika"
SkaiciaiS$(17) = "septyniolika"
SkaiciaiS$(18) = "aðtuoniolika"
SkaiciaiS$(19) = "devyniolika"
SkaiciaiS$(20) = "dvideðimt"
SkaiciaiS$(21) = "trisdeðimt"
SkaiciaiS$(22) = "keturiasdeðimt"
SkaiciaiS$(23) = "penkiasdeðimt"
SkaiciaiS$(24) = "ðeðiasdeðimt"
SkaiciaiS$(25) = "septyniasdeðimt"
SkaiciaiS$(26) = "aðtuoniasdeðimt"
SkaiciaiS$(27) = "devyniasdeðimt"
SkaiciaiS$(28) = "vienas ðimtas"
SkaiciaiS$(29) = "du ðimtai"
SkaiciaiS$(30) = "trys ðimtai"
SkaiciaiS$(31) = "keturi ðimtai"
SkaiciaiS$(32) = "penki ðimtai"
SkaiciaiS$(33) = "ðeði ðimtai"
SkaiciaiS$(34) = "septyni ðimtai"
SkaiciaiS$(35) = "aðtuoni ðimtai"
SkaiciaiS$(36) = "devyni ðimtai"
Static SkaiciaiL(36)
SkaiciaiL(1) = 1
SkaiciaiL(2) = 2
SkaiciaiL(3) = 2
SkaiciaiL(4) = 2
SkaiciaiL(5) = 2
SkaiciaiL(6) = 2
SkaiciaiL(7) = 2
SkaiciaiL(8) = 2
SkaiciaiL(9) = 2
SkaiciaiL(10) = 3
SkaiciaiL(11) = 3
SkaiciaiL(12) = 3
SkaiciaiL(13) = 3
SkaiciaiL(14) = 3
SkaiciaiL(15) = 3
SkaiciaiL(16) = 3
SkaiciaiL(17) = 3
SkaiciaiL(18) = 3
SkaiciaiL(19) = 3
SkaiciaiL(20) = 3
SkaiciaiL(21) = 3
SkaiciaiL(22) = 3
SkaiciaiL(23) = 3
SkaiciaiL(24) = 3
SkaiciaiL(25) = 3
SkaiciaiL(26) = 3
SkaiciaiL(27) = 3
SkaiciaiL(28) = 3
SkaiciaiL(29) = 3
SkaiciaiL(30) = 3
SkaiciaiL(31) = 3
SkaiciaiL(32) = 3
SkaiciaiL(33) = 3
SkaiciaiL(34) = 3
SkaiciaiL(35) = 3
SkaiciaiL(36) = 3
'Tuojau pat iðskirsime centus
ct$ = Right(Format(suma, "0.00"), 2)
For x = 3 To 1 Step -1
Mase = M(x)
MasesSuma = Int(suma / Mase)
Liko = suma - MasesSuma * Mase
suma = MasesSuma
If suma > 0 Then
For i = Max_sk To 1 Step -1
If suma >= SkaiciaiN(i) Then
Liet$ = Liet$ + SkaiciaiS$(i) + " "
Linksnis = SkaiciaiL(i)
suma = suma - SkaiciaiN(i)
End If
Next i
Liet$ = Liet$ + pinigai$(x, Linksnis) + " "
End If
suma = Liko
Linksnis = 3
Next x
If MasesSuma = 0 Then Liet$ = Liet$ + "litø"
'Cento tikslumu!
Liet$ = Trim(Liet$) & " " & ct$ & " ct"
'Pirma raidë - didþioji
Pirma$ = UCase$(Left$(Liet$, 1))
Kitos$ = Right$(Liet$, (Len(Liet$) - 1))
suma_lt = Pirma$ + Kitos$
Exit Function
klaida21:
Exit Function
End Function