简体   繁体   English

为什么不从另一个工作表中提取数组?

[英]Why isn't this pulling an array from another sheet?

I am trying to pull a two dimensional array from another sheet and I keep getting an error on the following line: 我正在尝试从另一张纸上拉一个二维数组,但在以下行中我不断收到错误消息:

FD_arr = FD.Range(Cells(2, 3), Cells(FD_TotalRows, 4)).Value

I can't figure out what is wrong with it. 我不知道这是怎么回事。

Sub Combine()

    Dim FD_strArray As Variant
    Dim FD_TotalRows As Long

    Set FD = ThisWorkbook.Sheets("FD")

    FD_TotalRows = FD.Rows(Rows.Count).End(xlUp).Row
    FD_arr = FD.Range(Cells(2, 3), Cells(FD_TotalRows, 4)).Value
    MsgBox FD_arr(4, 1) & " " & FD_arr(4, 2)

End Sub

您还需要使用工作表对单元调用进行限定。

FD_strArray = FD.Range(FD.Cells(2, 3), FD.Cells(FD_TotalRows, 4)).Value

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM