我收到1004错误声明,用于定义范围如下
Set rng(2) = ActiveSheet.Range("A2:" & Chr(64 + columnscount) & RowsCount)
之前我已计算过行数和列数(见下文)。你能告诉我这有什么问题吗?我很绝望。
非常感谢你。
i = 1
RowsCount = 0
Do Until IsEmpty(Cells(i, 2))
i = i + 1
RowsCount = RowsCount + 1
Loop
i = 1
columnscount = 0
Do Until IsEmpty(Cells(1, i))
i = i + 1
columnscount = columnscount + 1
Loop