Function vertaal(y)
c00 = Format(Val(1 * y), String(3 * ((Len(Format(Val(1 * y))) - 1) \ 3 + 1), "0"))
For j = 1 To Len(c00) \ 3
x = Mid(c00, 3 * (j - 1) + 1, 3)
sp = Array(mats(Left(x, 1)), mats(Val(Right(x, 2))), mats(Right(x, 1)), mats(Mid(x, 2, 1) & "0"), mats(Mid(x, 2, 1)))
c01 = c01 & IIf(sp(0) = "", "", sp(0) & "honderd") & IIf(Right(x, 2) = "00", "", IIf(sp(1) <> "", sp(1), sp(2) & IIf(Mid(x, 2, 1) = "1", _
sp(3), "en" & IIf(sp(3) = "", sp(4) & "tig", sp(3))))) & Choose(Len(c00) \ 3 - j + 1, "", "duizend ", " miljoen ", " miljard ")
Next
If Right(Format(y, ".00"), 2) <> "00" Then
x = Split(Format(y, ".00"), ",")(1)
sp = Array(mats(Val(x)), mats(Right(x, 1)), mats(Left(x, 1) & "0"), mats(Left(x, 1)))
c01 = c01 & " , " & IIf(sp(0) <> "", sp(0), sp(1) & IIf(Left(x, 1) = "1", sp(2), "en" & IIf(sp(2) = "", sp(3) & "tig", sp(2))))
End If
vertaal = IIf(c01 = "", "nul", Trim(Replace(Replace(Replace(Replace(" " & c01, " eendu", "du"), " eenho", "ho"), "eee", "eeë"), "rieen", "rieën")))
End Function
Function mats(y)
On Error Resume Next
mats = Split("__een_twee_drie_vier_vijf_zes_zeven_acht_negen_tien_elf_twaalf_dertien_veertien_twintig_dertig_veertig_tachtig", "_") _
(UBound(Split(Split("_0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_20_30_40_80_", y & "_")(0), "_")))
End Function