VBA为什么用Currency型不能表达-922337203685477.5808,只能表达 -922337203685477.5807@ ,少了我0.0001元,这是绝不允许的
(这是银行欠我的钱{:soso_e121:})
Dim Hi As Long, Lo As Long, MaxVal As Currency, MinVal As Currency
MaxVal = 922337203685477.5807@
MinVal = -922337203685477.5807@ '-922337203685477.5808@ -922337203685477.5807@
用你的例子:
sub test()
Dim Hi As Long, Lo As Long, MaxVal As Currency, MinVal As Currency,temp as Variant
MaxVal = 922337203685477.5807@
temp="-922337203685477.5808" '用字符串形式转入
MinVal = Ccur(temp) '将variant转成Currency,如果无法转,说明Currency有问题
Debug.Print MinVal
end sub
算术:mod 和 整除/ 和 所有逻辑,这些仅支持INTEGER, LONG(如果输入有小数,则转换取整) 作者: topses 时间: 2015-5-31 17:49
邪门的事情也发生LONG和INTEGER的类型上。难道是VBA的编译器的问题。(MS不至于这么傻,应该是自己的水平有限)
dim MinVal as long
MinVal =-2147483648&
dim MinVal as integer
MinVal =-32768% '由于VB自动转换为LONG型了,这里实际看不出来,但可以看到不可以用-32768表示整形