when i write
text1.text=val( 5/10)
the result will be .5
i need it 1/2
text1.text=val( 5/10)
the result will be .5
i need it 1/2
Public Function Dec2Frac(ByVal f As Double) As String Dim df As Double Dim lUpperPart As Long Dim lLowerPart As Long lUpperPart = 1 lLowerPart = 1 df = lUpperPart / lLowerPart While (df <> f) If (df < f) Then lUpperPart = lUpperPart + 1 Else lLowerPart = lLowerPart + 1 lUpperPart = f * lLowerPart End If df = lUpperPart / lLowerPart End While Dec2Frac = CStr(lUpperPart) & "/" & CStr(lLowerPart) End Function
Comment