round(YourNumber + 0.05, 1)
Private Function RoundMe(ByRef sngNo As Single) As Single
Dim aa = sngNo * 10
If a <> Int(a) Then
RoundMe = Round(sngNo + 0.05, 1)
Else
RoundMe = sngNo
End If
End Function
Dim i As Single
i = InputBox("input number")
MsgBox -Int(--Int(-i * 100) / 10) / 10
Sub Demo()
Dim MyVal As Double, Precision As Integer
MyVal = CDbl(InputBox("Value to Round Up"))
Precision = CInt(InputBox("Round up Precision"))
MsgBox Roundup(MyVal, Precision)
End SubFunction Roundup(MyVal As Double, Precision As Integer) As Single
If Int(MyVal * 10 ^ Precision) = (MyVal * 10 ^ Precision) Then
Roundup = MyVal
Else
Roundup = -(Int(-MyVal * 10 ^ Precision) / 10 ^ Precision)
End If
End Function
برچسب:
نویسنده: محمد رضا جوادیان