Here is an example of my code, lightly changed, since it contains some dutch...
Dim i As Currency
i = textbox1.Value * textbox2.Value \ 1000
If textbox1.Value = True Then
If textbox1.Value = False Then
label1.Caption = False
Else
label1.Caption = i
End If
Else
label1.Caption = False
End If
> Here is an example of my code, lightly changed, since it contains some
> dutch...
>
> Dim i As Currency
> i = textbox1.Value * textbox2.Value \ 1000
I am no expert, but shouldn't this read:
i = textbox1.Value * textbox2.Value / 1000
The '\' rounds off the results to a whole number, with MOD giving the
remainder.
Erwin
Hi Guus,
apart from datatype conversion issues,
this will hardly make sense:
> If textbox1.Value = True Then
> If textbox1.Value = False Then
Depending on regional settings
on how to display numbers,
you have to be very careful,
when converting strings to doubles or singles.
Whereas the surface of windows
may use the international settings,
the VBA-code doesn't.
When you convert a string to a single,
the VBA-code expects a string like "1000.14".
So you have to remove possible 1000s seperators,
and to make sure, that the decimal seperator is a period (.)
If I had to create a userform, which should accept decimal fractions,
i would use _two_ textboxes. One for the whole number,
one for the fractions:
like [xxxxx],[xxxxxx] on the european continent.
And as input I would allow nothing but digits.

Signature
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
Guus van Waardenburg - 05 May 2006 08:12 GMT
Thank you Guys,
Ik know I have to work on the functionality of my code! It's my first one.
I flipped the slash and indeed it works out fine.
The program works fine now. Now for stripping the code to functionality...
Best regards.
> Hi Guus,
>
[quoted text clipped - 24 lines]
>
> And as input I would allow nothing but digits.