Why cells(1,1) = 500 * 100 causes overflow but 50000*100 doesn't?

前端 未结 4 1437
心在旅途
心在旅途 2020-12-15 02:29

I just created a simple sub and it gives an overflow error. However, I don\'t see anything wrong with the code, and it is really weird since 50000*100 is much b

4条回答
  •  臣服心动
    2020-12-15 03:03

    i got the answer from the following link: Link from microsoft

    it seems that even I did not assign a type to the number, excel automatically assign one to it based on its length. Thus, 500 is defined as integer and the result 50,000 is too big for type integer. That's why.

提交回复
热议问题