1、写一个自定义函数:
function fn(val as singe) as integer
dim num as integer
val=cint(val) '取整
num=val mod 10 '取个位数
if num>=5 then
val=cint(val/10)*10+5
else
val=cint(val/10)*10 '个位置零
end if
fn=val
end fuction
Function fn(val As Single) As Integer
Dim num As Integer
val = Int(val) '取整
num = val Mod 10 '取个位数
If num >= 5 Then
val = Int(val / 10) * 10 + 5
Else
val = Int(val / 10) * 10 '个位置零
End If
fn = val
End Function