//(-)Round Function in Vb 6.00
If You Want To Round in last 2 digit Exm. 151 = 200 And 149 = 100 Round1(Value,-2)
Private Function Round1(DouAmt As Double, IntDegit As Integer) As Double
IntDegit = Abs(IntDegit)
DouAmt = Round(DouAmt)
If IntDegit = 0 Then
Round1 = DouAmt
Exit Function
End If
If Right(DouAmt, IntDegit) < Val('5' + String(IntDegit - 1, '0')) Then
Round1 = (DouAmt - Right(DouAmt, IntDegit))
Else
Round1 = (DouAmt - Right(DouAmt, IntDegit)) + Val('10' + String(IntDegit - 1, '0'))
End If
End Function
End Function
If You Want To Round in last 2 digit Exm. 151 = 200 And 149 = 100 Round1(Value,-2)
Private Function Round1(DouAmt As Double, IntDegit As Integer) As Double
IntDegit = Abs(IntDegit)
DouAmt = Round(DouAmt)
If IntDegit = 0 Then
Round1 = DouAmt
Exit Function
End If
If Right(DouAmt, IntDegit) < Val('5' + String(IntDegit - 1, '0')) Then
Round1 = (DouAmt - Right(DouAmt, IntDegit))
Else
Round1 = (DouAmt - Right(DouAmt, IntDegit)) + Val('10' + String(IntDegit - 1, '0'))
End If
End Function
End Function
No comments:
Post a Comment