VBA Macro crashes after 32000 rows

后端 未结 3 1637
遇见更好的自我
遇见更好的自我 2020-11-27 08:06

I have a VBA macro that copies rows from one worksheet into another based upon finding values in cells in 3 columns. The macro works, but crashes when it reaches row 32767.

3条回答
  •  鱼传尺愫
    2020-11-27 08:13

    The VBA 'Int' type is a signed 16-bit field so it can only hold values from -32768 to +32767. Change those variables to 'Long', which is a signed 32-bit field and can hold values from -2147483648 to +2147483647. Should be enough for Excel. ;)

提交回复
热议问题