[英]How to refer to an open workbook in VBA?
Dim test As Range
Set test = Workbooks("MonthlyReport.xlsb").Worksheets("VC Report").Range("C1")
VBA shows Error 9: Subscript out of range. VBA显示错误9:下标超出范围。 Why is this? 为什么是这样? What is wrong with it? 怎么了 The workbook MonthlyReport.xlsb is open. 工作簿MonthlyReport.xlsb已打开。
Your code works fine for me (Excel 2007 / Win 7). 您的代码对我来说效果很好(Excel 2007 / Win 7)。 Check the spelling of the workbook and worksheet. 检查工作簿和工作表的拼写 。 (especially matching spaces) (特别是匹配的空格)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.