运行时错误6:溢出-Excel VBA

时间:2018-07-30 09:46:24

标签: vba excel-vba

有人知道为什么这会给我一个运行时错误6:溢出吗?

Sheets("Raw data").Select
Dim lastrow2 As Integer
Dim lastcol2 As Integer

lastcol2 = Cells(1, Columns.Count).End(xlToLeft).Column
lastrow2 = Cells(Rows.Count, 1).End(xlUp).Row

Range(Cells(1, 1), Cells(lastrow2, lastcol2)).Name = "RawData"

我在另一张纸上使用了完全相同的vbs代码,并且运行良好。我所做的只是将变量重命名为lastrow2和lastcol2。我认为正是lastrow2行给我带来了问题。

0 个答案:

没有答案