【发布时间】:2020-11-15 06:38:52
【问题描述】:
我正在练习将单元格“1.5”的值分配给另一个单元格中的值,但它一直在单元格中放置 2.0。这是我正在使用的代码。
Sub NumberaVariable()
' Declare a Integer Variable, name it "aPrice"
Dim aPrice As Integer
' Have it store the prce information from H3
aPrice = Range("H3").Value
'Paste the price information in C5
Range("C5").Value = aPrice
End Sub
我尝试过使用单元格格式,甚至通过公式测试了 H3 的内容 =+(H3) 在单元格 C5 中,它产生了 1.5 的预期值。我很难理解为什么它会在单元格 H3 中的值上加上 0.5。
谁能帮我理解为什么会这样?
【问题讨论】:
标签: excel vba variables variable-assignment