错误1004 – 在范围命令中使用表格时,应用程序定义或对象定义的错误

我是VBA的新手,有一个命令的问题,我已经把它分离出来一个单独的Excel电子表格,仍然不能得到它的工作。

如果我在活动工作表上使用以下,一切都很好

Range(Cells(1, 1), Cells(99, 2)).Value = "Test" 

但是当我使用:

 Sheets("one").Range(Cells(1, 1), Cells(99, 2)).Value = "Test" 

我收到错误1004 application defined or object defined error

我的工作簿中有名为“one”的工作表。

我花了几个小时search谷歌,但没有运气,谁能提出什么是错的?

您还必须限定Cells()对象

 Sub Sample() With Sheets("one") .Range(.Cells(1, 1), .Cells(99, 2)).Value = "Test" End With End Sub