简单的溢出问题 [英] Simple overflow problem

查看:74
本文介绍了简单的溢出问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我为什么这在MS Excel 2013中不起作用吗? 我在2台不同的电脑上试过了。 我收到"a"溢出。 我已经尝试了很长时间,整数,变种..所有都溢出。 我重启了excel。 
造成这种情况的原因是什么?

Can someone please tell me why this doesn't work in MS Excel 2013?  I've tried it on 2 different computers.  I get an overflow on "a".  I've tried long, integer, variant.. all give overflow.  I've restarted excel.  What could be causing this?

子问题()

Dim a As双倍b $ b    a = 901 * 576

Dim a As Double
    a = 901 * 576

结束子

推荐答案

VBA将901和576解释为(短)整数; 901 * 576的结果超出了整数的范围。

VBA interprets 901 and 576 as (short) Integers; the result of 901 * 576 is outside the range for Integers.

尝试

a = 901#* 576#

a = 901# * 576#

代替;这会强制数字被解释为Double。

instead; this forces the numbers to be interpreted as Double.


这篇关于简单的溢出问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆