Tag: 长整型

长数据types不在Excel VBA中存储长期值

当我在Excel VBA中执行下面的代码时,第一个消息框会正确返回long值,但是当我将该值存储在长数据types和消息框中时,longvariables返回0(?!)。 Sub Test() Dim lFileCount As Long Dim lAdder As Long lFileCount = 1 MsgBox 0.35! + (0.15! / lFileCount) lAdder = 0.35! + (0.15! / lFileCount) MsgBox lAdder MsgBox Format(lAdder, "0.0") End Sub 感叹号的原因是由于项目中的漫长的溢出,我从中推导出了代码。 如果我删除它不会改变结果。 我不知道可能是什么原因造成的,我首先想到的是这个variables是如何按照操作顺序存储的,但是我没有任何解决方法。 我很困惑,任何帮助将不胜感激!

VBA问题:简单的操作与多种types的variables

在处理VBA函数中的Excel 2010中不同types的variables时,我遇到了一个非常烦人的问题。 我已经尝试了以下代码与广告没有Excel转换感谢关于同样的溢出问题(错误6)的其他问题,但它没有解决(我可能做错了,但我没有我的指示了) Function do_calculation(lig_desti As Integer, col_desti As Integer) Range(Cells(lig_desti, col_desti), Cells(lig_desti, col_desti)).Value = Range(Cells(lig_desti, col_desti – 3), Cells(lig_desti, col_desti – 3)).Value * (Range(Cells(lig_desti, col_desti – 1), Cells(lig_desti, col_desti – 1)).Value / Range(Cells(lig_desti, col_desti – 2), Cells(lig_desti, col_desti – 2)).Value) End Function 只是总结,我想要做的(对于每一行)D = A *(C / B)。 这个想法是,我有3列值,这是第一行只是给你一个想法: ABCD 2187 71,8 18 1050 […]