如何解决尝试从 VBA 中的外部 Excel 工作表中提取动态数组时出现运行时错误 438
我正在从一个 excel 文件运行我的代码,该文件旨在从一堆其他 excel 文件中聚合数据。我想从名为“已接收案例”的 excel 文件中提取一个数组,但出现运行时错误 438:对象不支持此属性或方法。
Dim srcWarehouse As Workbook
'Storing the worksheet with my desired data as a variable with the object type workbook'
Set srcWarehouse = Workbooks.Open("C:\Users\christian.pignataro\Documents\Timeline Accuracy project\Cases Received 2021.xlsx",True,True)
Dim numbers() As Integer,size As Integer,i As Integer
'This next line is the line that throws the error it is intended to use the worksheet function
'CountA to count the length of the array since the size of the listed data on the Cases
'Received workbook will change each month
size = srcWarehouse.Worksheets("Sheet1").WorksheetFunction.CountA(Worksheets(1).Columns(1))
ReDim numbers(size)
For i = 1 To size
numbers(i) = srcWarehouse.Worksheets("Sheet1").Cells(i,1).Value
Next i
MsgBox numbers(size)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。