2

After updating from Office 2007 to Office 2010, the macros that worked perfectly in Excel 2007 but do not work in 2010. Specifically i recieved a error on this line:

    y = Worksheets("Raw Data").Range("A2").End(xlDown).Row

Ther error is "error 6 Overflow". I have come to realize that it is due to Excel selecting the max number(1048576) of rows in excel that creates the overflow. There is only data in 975 of these rows. In 2007 it only selected the rows with data. I am wondering what has caused the change in the way that code is handled from 2007 to 2010? Has anyone else experienced this?

4

2 回答 2

1

确保y variable(以及引用行号的其他变量)声明为Long,例如:

Dim y As Long

我可以猜到你的变量是Integer此刻。

我猜你可能同时将你的文件迁移.xls.xlsm了其中,这可能会导致一些问题。

于 2013-05-28T19:19:45.957 回答
0

试试下面

  With Worksheets("Raw Data")
        y = .Range("A" & .Rows.Count).End(xlUp).Row
    End With
于 2013-05-28T19:17:20.397 回答