数据处理的自定义函数,供大家分享w@Hмbbs.3c3t.com®c´nðr³
Public Function RoundCint(shuzhi, amanalong)w@Hмbbs.3c3t.com®c´nðr³
w@Hмbbs.3c3t.com®c´nðr³
'当小数部分恰好为 0.5 时,Cint 和 CLng 函数会将它转换为最接近的偶数值。例如,0.5 转换为 0、1.5 转换为 2。Cintw@Hмbbs.3c3t.com®c´nðr³
'和 CLng 函数不同于 Fix 和 Int 函数,Fix 和 Int 函数会将小数部分截断而不是四舍五入。w@Hмbbs.3c3t.com®c´nðr³
w@Hмbbs.3c3t.com®c´nðr³
Dim amanglong As Longw@Hмbbs.3c3t.com®c´nðr³
w@Hмbbs.3c3t.com®c´nðr³
Dim weishu As Doublew@Hмbbs.3c3t.com®c´nðr³
w@Hмbbs.3c3t.com®c´nðr³
weishu = amanalongw@Hмbbs.3c3t.com®c´nðr³
w@Hмbbs.3c3t.com®c´nðr³
baoliuweishu = shuzhi * (10 ^ weishu)w@Hмbbs.3c3t.com®c´nðr³
w@Hмbbs.3c3t.com®c´nðr³
RoundCint = CInt(baoliuweishu) / 10 ^ weishuw@Hмbbs.3c3t.com®c´nðr³
w@Hмbbs.3c3t.com®c´nðr³
End Functionw@Hмbbs.3c3t.com®c´nðr³